org.cyberlab.local.recognition.extractor.net
Class SocketLocalFeaturesExtractor

java.lang.Object
  extended by org.cyberlab.local.recognition.extractor.LocalFeaturesExtractor
      extended by org.cyberlab.local.recognition.extractor.net.SocketLocalFeaturesExtractor

public class SocketLocalFeaturesExtractor
extends LocalFeaturesExtractor

Features extractor that uses socket connections to an external server helping in extracting features and descriptors. Warning: The extractor supports almost all feature detectors and descriptor extractors in OpenCV. The bugs are in the external socket server code. For more information about the descriptors and features supported in OpenCV refer to the official OpenCV documentation.

Author:
Mats-Gøran Karlsen

Field Summary
 
Fields inherited from class org.cyberlab.local.recognition.extractor.LocalFeaturesExtractor
descriptorType, featureType, type
 
Constructor Summary
SocketLocalFeaturesExtractor(java.lang.String ip, int port)
          The default extractor constructor uses SURF for feature detection and descriptor extraction.
SocketLocalFeaturesExtractor(java.lang.String ip, int port, int featureType, int descriptorType)
          The advanced extractor can use all the feature detectors currently supported by OpenCV:
"FAST" – FastFeatureDetector
"STAR" – StarFeatureDetector
"SIFT" – SIFT (nonfree module)
"SURF" – SURF (nonfree module)
"ORB" – ORB
"MSER" – MSER
"GFTT" – GoodFeaturesToTrackDetector
"HARRIS" – GoodFeaturesToTrackDetector with Harris detector enabled
"DENSE" – DenseFeatureDetector
"SIMPLEBLOB" – SimpleBlobDetector

Also a combined format is supported: feature detector adapter name
("GRID" – GridAdaptedFeatureDetector, "PYRAMID" – PyramidAdaptedFeatureDetector) + feature detector name (see above), for example: "GRID_FAST", "PYRAMID_STAR".
WARNING: The "Dynamic" feature detectors are only used by the Android version of OpenCV and doesn't exist on other platforms than OpenCV.
 
Method Summary
 ImageFeatures getFeatures(Bitmap image)
          This method implements the complete communication control protocol.

The overall communication protocol follows this pattern:
1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketLocalFeaturesExtractor

public SocketLocalFeaturesExtractor(java.lang.String ip,
                                    int port)
The default extractor constructor uses SURF for feature detection and descriptor extraction.

Parameters:
ip - the socket server IP
port - the socket server port number

SocketLocalFeaturesExtractor

public SocketLocalFeaturesExtractor(java.lang.String ip,
                                    int port,
                                    int featureType,
                                    int descriptorType)
The advanced extractor can use all the feature detectors currently supported by OpenCV:
"FAST" – FastFeatureDetector
"STAR" – StarFeatureDetector
"SIFT" – SIFT (nonfree module)
"SURF" – SURF (nonfree module)
"ORB" – ORB
"MSER" – MSER
"GFTT" – GoodFeaturesToTrackDetector
"HARRIS" – GoodFeaturesToTrackDetector with Harris detector enabled
"DENSE" – DenseFeatureDetector
"SIMPLEBLOB" – SimpleBlobDetector

Also a combined format is supported: feature detector adapter name
("GRID" – GridAdaptedFeatureDetector, "PYRAMID" – PyramidAdaptedFeatureDetector) + feature detector name (see above), for example: "GRID_FAST", "PYRAMID_STAR".
WARNING: The "Dynamic" feature detectors are only used by the Android version of OpenCV and doesn't exist on other platforms than OpenCV. This feature is not disabled in the constructor and trying to use it crashes the server. The constructor should reject attempts to use this by either throwing an exception or falling back to the non dynamic type of the feature detector.
The advanced extractor can use all the descriptor extractors currently supported by OpenCV:
"SIFT" – SIFT
"SURF" – SURF
"ORB" – ORB
"BRIEF" – BriefDescriptorExtractor

A combined format is also supported: descriptor extractor adapter name
( "OPPONENT" – OpponentColorDescriptorExtractor ) + descriptor extractor name (see above), for example: "OPPONENT_SIFT".

For more info see official OpenCV documentation.

Parameters:
ip - the socket server IP
port - the socket server port number
featureType - The feature detector type
descriptorType - The descriptor extractor type
Method Detail

getFeatures

public ImageFeatures getFeatures(Bitmap image)
This method implements the complete communication control protocol.

The overall communication protocol follows this pattern:
1. The client authenticates.
2. Client sends intent.
3. Client sends file and waits for reply.
4. Server performs operations based on the intent(2) from the client.
5. Server sends file and closes its connection
6. The client closes its connection.

See the specific methods for protocol details.

Specified by:
getFeatures in class LocalFeaturesExtractor
See Also:
SocketComm, SocketComm.authenticate(byte[], String, String), SocketComm.extractIntent(byte[], String, String), SocketComm.sendFile(File, byte[]), SocketComm.receiveFile(String, byte[]), org.cyberlab.local.recognition.extractor.LocalFeaturesExtractor#getFeatures(android.graphics.Bitmap)