_ImageFeatureManagerImpl::_ImageFeatureManagerImpl(void)
: __imageFeatureManager(0)
, __readOnly(false)
+ , __minSupportedSize(100)
+ , __maxSupportedResolution(16000000)
{
}
int
_ImageFeatureManagerImpl::AddFeature(const Tizen::Base::String& filepath)
{
+ Tizen::Media::ImageFormat imgFormat;
+ int imgWidth = 0, imgHeight = 0;
+ result r = Tizen::Media::ImageBuffer::GetImageInfo(filepath, imgFormat, imgWidth, imgHeight);
+ if (IsFailed(r))
+ {
+ return -1;
+ }
+
+ if ((imgWidth < __minSupportedSize || imgHeight < __minSupportedSize) || (imgWidth*imgHeight > __maxSupportedResolution))
+ {
+ return -1;
+ }
+
Tizen::Media::ImageBuffer imBuf;
- result r = imBuf.Construct(filepath, null, false);
+ r = imBuf.Construct(filepath, null, false);
if (IsFailed(r))
{
return -1;
{
return -1;
}
+
+ if ((width < __minSupportedSize || height < __minSupportedSize) || (width*height > __maxSupportedResolution))
+ {
+ return -1;
+ }
+
Tizen::Text::Utf8Encoding utf8;
std::unique_ptr<Tizen::Base::ByteBuffer> pBuffer(utf8.GetBytesN(info));
int index = (int) __imageFeatureManager->addImageToDB(data, width, height, (char*) pBuffer->GetPointer());
Tizen::Base::String __path;
Tizen::Base::Collection::ArrayListT<int> __indices;
bool __readOnly;
+ int __minSupportedSize;
+ int __maxSupportedResolution;
};
} } } //Tizen::Uix::Vision