mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-18 08:44:11 +08:00
modify samples for feature storing option
This commit is contained in:
@@ -72,7 +72,6 @@ the use of this software, even if advised of the possibility of such damage.
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include "opencv2/highgui/highgui_c.h"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
using std::string;
|
||||
using caffe::Blob;
|
||||
using caffe::Caffe;
|
||||
using caffe::Datum;
|
||||
@@ -185,7 +184,7 @@ namespace cnn_3dobj
|
||||
|
||||
/** @brief Suit the position of bytes in 4 byte data structure for particular system.
|
||||
*/
|
||||
CV_WRAP static uint32_t swapEndian(uint32_t val);
|
||||
CV_WRAP static int swapEndian(int val);
|
||||
|
||||
/** @brief Create header in binary files collecting the image data and label.
|
||||
@param num_item Number of items.
|
||||
@@ -206,7 +205,7 @@ namespace cnn_3dobj
|
||||
@param z Pose label of Z.
|
||||
@param isrgb Option for choice of using RGB images or not.
|
||||
*/
|
||||
CV_WRAP static void writeBinaryfile(string filenameImg, const char* binaryPath, const char* headerPath, int num_item, int label_class, int x, int y, int z, int isrgb);
|
||||
CV_WRAP static void writeBinaryfile(String filenameImg, const char* binaryPath, const char* headerPath, int num_item, int label_class, int x, int y, int z, int isrgb);
|
||||
};
|
||||
|
||||
/** @brief Caffe based 3D images descriptor.
|
||||
@@ -223,13 +222,13 @@ namespace cnn_3dobj
|
||||
bool net_set;
|
||||
int net_ready;
|
||||
cv::Mat mean_;
|
||||
string deviceType;
|
||||
String deviceType;
|
||||
int deviceId;
|
||||
|
||||
/** @brief Load the mean file in binaryproto format if it is needed.
|
||||
@param mean_file Path of mean file which stores the mean of training images, it is usually generated by Caffe tool.
|
||||
*/
|
||||
void setMean(const string& mean_file);
|
||||
void setMean(const String& mean_file);
|
||||
|
||||
/** @brief Wrap the input layer of the network in separate cv::Mat objects(one per channel).
|
||||
This way we save one memcpy operation and we don't need to rely on cudaMemcpy2D.
|
||||
@@ -246,11 +245,11 @@ namespace cnn_3dobj
|
||||
@param device_type CPU or GPU.
|
||||
@param device_id ID of GPU.
|
||||
*/
|
||||
descriptorExtractor(const string& device_type, int device_id = 0);
|
||||
descriptorExtractor(const String& device_type, int device_id = 0);
|
||||
|
||||
/** @brief Get device type information for feature extraction.
|
||||
*/
|
||||
string getDeviceType();
|
||||
String getDeviceType();
|
||||
|
||||
/** @brief Get device ID information for feature extraction.
|
||||
*/
|
||||
@@ -260,7 +259,7 @@ namespace cnn_3dobj
|
||||
Useful to change device without the need to reload the net.
|
||||
@param device_type CPU or GPU.
|
||||
*/
|
||||
void setDeviceType(const string& device_type);
|
||||
void setDeviceType(const String& device_type);
|
||||
|
||||
/** @brief Set device ID information for feature extraction.
|
||||
Useful to change device without the need to reload the net. Only used for GPU.
|
||||
@@ -274,7 +273,7 @@ namespace cnn_3dobj
|
||||
@param trained_file Path of prototxt which defining the structure of CNN.
|
||||
@param mean_file Path of mean file(option).
|
||||
*/
|
||||
void loadNet(const string& model_file, const string& trained_file, const string& mean_file = "");
|
||||
void loadNet(const String& model_file, const String& trained_file, const String& mean_file = "");
|
||||
|
||||
/** @brief Extract features from a single image or from a vector of images.
|
||||
If loadNet was not called before, this method invocation will fail.
|
||||
@@ -282,7 +281,7 @@ namespace cnn_3dobj
|
||||
@param feature Output features.
|
||||
@param feature_blob Layer which the feature is extracted from.
|
||||
*/
|
||||
void extract(InputArrayOfArrays inputimg, OutputArray feature, std::string feature_blob);
|
||||
void extract(InputArrayOfArrays inputimg, OutputArray feature, String feature_blob);
|
||||
};
|
||||
//! @}
|
||||
}
|
||||
|
Reference in New Issue
Block a user