summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTae-Young Chung <ty83.chung@samsung.com>2016-06-23 13:55:31 +0900
committerTae-Young Chung <ty83.chung@samsung.com>2016-06-23 13:59:52 +0900
commit9db5b0e313474a3bb82caaf2d8fc126949f4c738 (patch)
treec5523a6c04ecb6dda7aef0744000268f071422da
parent927d276fcc5798ccb07cd9c3d4e540d49f3a4cfd (diff)
downloadmediavision-9db5b0e313474a3bb82caaf2d8fc126949f4c738.tar.gz
mediavision-9db5b0e313474a3bb82caaf2d8fc126949f4c738.tar.bz2
mediavision-9db5b0e313474a3bb82caaf2d8fc126949f4c738.zip
1. remove redundant blank line and whitespace at the end of lines 2. fixed open brace place; put the open brace at the end of line Change-Id: Ib2d554eb3ec15cc4579b4835eac2be10bff5484a Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
-rw-r--r--mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp1
-rw-r--r--mv_face/face/src/FaceRecognitionModel.cpp1
-rw-r--r--mv_image/image/src/Features/FeatureMatcher.cpp6
-rw-r--r--mv_image/image/src/Features/ORBExtractorFactory.cpp2
-rw-r--r--mv_image/image/src/Tracking/MFTracker.cpp1
-rw-r--r--packaging/capi-media-vision.spec2
-rw-r--r--test/testsuites/common/image_helper/src/ImageHelper.cpp494
-rw-r--r--test/testsuites/common/image_helper/src/image_helper.cpp12
8 files changed, 239 insertions, 280 deletions
diff --git a/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp b/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp
index ddf552e2..493f68e9 100644
--- a/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp
+++ b/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp
@@ -446,7 +446,6 @@ int mv_barcode_generate_image_open(
value = bgcolour[1];
bgcolour[1] = bgcolour[5];
bgcolour[5] = value;
-
}
error = BarcodeGenerator::generateBarcodeToImage(
diff --git a/mv_face/face/src/FaceRecognitionModel.cpp b/mv_face/face/src/FaceRecognitionModel.cpp
index 36863424..b8ae24b4 100644
--- a/mv_face/face/src/FaceRecognitionModel.cpp
+++ b/mv_face/face/src/FaceRecognitionModel.cpp
@@ -191,7 +191,6 @@ FaceRecognitionModel::~FaceRecognitionModel()
int FaceRecognitionModel::save(const std::string& fileName)
{
if (!m_recognizer.empty()) {
-
std::string filePath;
filePath = fileName;
diff --git a/mv_image/image/src/Features/FeatureMatcher.cpp b/mv_image/image/src/Features/FeatureMatcher.cpp
index 0d00d10b..74b4312e 100644
--- a/mv_image/image/src/Features/FeatureMatcher.cpp
+++ b/mv_image/image/src/Features/FeatureMatcher.cpp
@@ -109,7 +109,7 @@ size_t matchesSelection(
if (abs(filterAmount - leftLimit) <= (int)allowableError)
break;
-
+
if ((int)filterAmount > leftLimit) {
requiredNumber -= leftLimit - startLeftLimit;
@@ -143,10 +143,10 @@ FeatureMatcher::MatchError FeatureMatcher::match(
{
if (MinimumNumberOfFeatures > from.m_objectKeypoints.size())
return InvalidFeaturePackFrom;
-
+
if (MinimumNumberOfFeatures > to.m_objectKeypoints.size())
return InvalidFeaturePackTo;
-
+
if (from.m_descriptorsType != to.m_descriptorsType)
return DisparateTypes;
diff --git a/mv_image/image/src/Features/ORBExtractorFactory.cpp b/mv_image/image/src/Features/ORBExtractorFactory.cpp
index 2ac5d81e..8ac34df4 100644
--- a/mv_image/image/src/Features/ORBExtractorFactory.cpp
+++ b/mv_image/image/src/Features/ORBExtractorFactory.cpp
@@ -104,7 +104,7 @@ float ORBExtractorFactory::computeRecognitionRate(
size_t xCellIdx = keypoints[i].pt.x / cellWidth;
if (xCellIdx >= xCellsNumber)
xCellIdx = xCellsNumber - 1;
-
+
size_t yCellIdx = keypoints[i].pt.y / cellHeight;
if (yCellIdx >= yCellsNumber)
yCellIdx = yCellsNumber - 1;
diff --git a/mv_image/image/src/Tracking/MFTracker.cpp b/mv_image/image/src/Tracking/MFTracker.cpp
index d2674b0c..df7f2a73 100644
--- a/mv_image/image/src/Tracking/MFTracker.cpp
+++ b/mv_image/image/src/Tracking/MFTracker.cpp
@@ -34,7 +34,6 @@ namespace {
return (copy[size/2-1]+copy[size/2])/((T)2.0);
else
return copy[(size - 1) / 2];
-
}
inline float l2distance(cv::Point2f p1, cv::Point2f p2) {
diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec
index c0ce93a7..8707ca14 100644
--- a/packaging/capi-media-vision.spec
+++ b/packaging/capi-media-vision.spec
@@ -1,7 +1,7 @@
Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
Version: 0.3.20
-Release: 2
+Release: 3
Group: Multimedia/Framework
License: Apache-2.0 and BSD-2.0
Source0: %{name}-%{version}.tar.gz
diff --git a/test/testsuites/common/image_helper/src/ImageHelper.cpp b/test/testsuites/common/image_helper/src/ImageHelper.cpp
index 7e132061..6d03b9d1 100644
--- a/test/testsuites/common/image_helper/src/ImageHelper.cpp
+++ b/test/testsuites/common/image_helper/src/ImageHelper.cpp
@@ -46,183 +46,166 @@ static const int QuadrangleVertices = 4;
std::vector<std::string> getJPGExtensions()
{
- std::vector<std::string> extensions;
- extensions.push_back(".jpg");
- extensions.push_back(".jpe");
- extensions.push_back(".jpeg");
- return extensions;
+ std::vector<std::string> extensions;
+ extensions.push_back(".jpg");
+ extensions.push_back(".jpe");
+ extensions.push_back(".jpeg");
+ return extensions;
}
} /* anonymous namespace */
int ImageHelper::loadImageToBuffer(
- const char *filePath,
- unsigned char **pDataBuffer,
- unsigned long *pBufferSize,
- ImageData *pImageData)
+ const char *filePath,
+ unsigned char **pDataBuffer,
+ unsigned long *pBufferSize,
+ ImageData *pImageData)
{
- if (filePath == NULL || pDataBuffer == NULL ||
- pBufferSize == NULL || pImageData == NULL)
- {
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
+ if (filePath == NULL || pDataBuffer == NULL ||
+ pBufferSize == NULL || pImageData == NULL)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- cv::Mat image;
- image = cv::imread(filePath);
+ cv::Mat image;
+ image = cv::imread(filePath);
- if (!image.data)
- {
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
+ if (!image.data)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- cv::cvtColor(image, image, CV_BGR2RGB);
+ cv::cvtColor(image, image, CV_BGR2RGB);
- *pBufferSize = image.total() * image.elemSize();
- (*pDataBuffer) = new unsigned char[*pBufferSize];
- std::memcpy(*pDataBuffer, image.data, *pBufferSize);
+ *pBufferSize = image.total() * image.elemSize();
+ (*pDataBuffer) = new unsigned char[*pBufferSize];
+ std::memcpy(*pDataBuffer, image.data, *pBufferSize);
- pImageData->imageWidth = image.cols;
- pImageData->imageHeight = image.rows;
- pImageData->imageColorspace = OpenCVColor;
+ pImageData->imageWidth = image.cols;
+ pImageData->imageHeight = image.rows;
+ pImageData->imageColorspace = OpenCVColor;
- return MEDIA_VISION_ERROR_NONE;
+ return MEDIA_VISION_ERROR_NONE;
}
int ImageHelper::saveImageFromBuffer(
- const char *filePath,
- unsigned char *pDataBuffer,
- const ImageData& imageData,
- int quality)
+ const char *filePath,
+ unsigned char *pDataBuffer,
+ const ImageData& imageData,
+ int quality)
{
- if (filePath == NULL || pDataBuffer == NULL)
- {
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
-
- static const std::string defaultFilePath = "out";
- static const std::vector<std::string> jpgExtensions = getJPGExtensions();
-
- bool rightExtensionFlag = false;
-
- std::string resultFilePath(filePath);
- if (resultFilePath.empty())
- {
- resultFilePath = defaultFilePath;
- } else {
- for (size_t extNum = 0; extNum < jpgExtensions.size(); ++extNum)
- {
- if (resultFilePath.size() >= jpgExtensions[extNum].size())
- {
- std::string givenExtension = resultFilePath.substr(
- resultFilePath.length() - jpgExtensions[extNum].size(),
- jpgExtensions[extNum].size());
-
- std::transform(
- givenExtension.begin(), givenExtension.end(),
- givenExtension.begin(), ::tolower);
-
- if (givenExtension == jpgExtensions[extNum])
- {
- rightExtensionFlag = true;
- break;
- }
- }
- }
- }
- if (!rightExtensionFlag)
- {
- resultFilePath += jpgExtensions[0];
- }
-
- if (quality <= 0 || quality > 100)
- {
- quality = 100;
- }
-
- unsigned int width = imageData.imageWidth;
- unsigned int height = imageData.imageHeight;
-
- int conversionType = -1; // Type of conversion from given colorspace to BGR
- unsigned int channelsNumber = 0;
- switch (imageData.imageColorspace)
- {
- case MEDIA_VISION_COLORSPACE_INVALID:
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- case MEDIA_VISION_COLORSPACE_Y800:
- channelsNumber = 1;
- conversionType = CV_GRAY2BGR;
- break;
- case MEDIA_VISION_COLORSPACE_I420:
- channelsNumber = 1;
- height *= 1.5;
- conversionType = CV_YUV2BGR_I420;
- break;
- case MEDIA_VISION_COLORSPACE_NV12:
- channelsNumber = 1;
- height *= 1.5;
- conversionType = CV_YUV2BGR_NV12;
- break;
- case MEDIA_VISION_COLORSPACE_YV12:
- channelsNumber = 1;
- height *= 1.5;
- conversionType = CV_YUV2BGR_YV12;
- break;
- case MEDIA_VISION_COLORSPACE_NV21:
- channelsNumber = 1;
- height *= 1.5;
- conversionType = CV_YUV2BGR_NV21;
- break;
- case MEDIA_VISION_COLORSPACE_YUYV:
- channelsNumber = 2;
- conversionType = CV_YUV2BGR_YUYV;
- break;
- case MEDIA_VISION_COLORSPACE_UYVY:
- channelsNumber = 2;
- conversionType = CV_YUV2BGR_UYVY;
- break;
- case MEDIA_VISION_COLORSPACE_422P:
- channelsNumber = 2;
- conversionType = CV_YUV2BGR_Y422;
- break;
- case MEDIA_VISION_COLORSPACE_RGB565:
- channelsNumber = 2;
- conversionType = CV_BGR5652BGR;
- break;
- case MEDIA_VISION_COLORSPACE_RGB888:
- channelsNumber = 3;
- conversionType = CV_RGB2BGR;
- break;
- case MEDIA_VISION_COLORSPACE_RGBA:
- channelsNumber = 4;
- conversionType = CV_RGBA2BGR;
- break;
- default:
- return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
- }
-
- const int depth = CV_8U;
- cv::Mat cvImage(cv::Size(width, height),
- CV_MAKETYPE(depth, channelsNumber), pDataBuffer);
- cv::Mat cvBGRImage;
- cv::cvtColor(cvImage, cvBGRImage, conversionType);
-
- std::vector<int> compression_params(2);
- compression_params[0] = CV_IMWRITE_JPEG_QUALITY;
- compression_params[1] = quality;
-
- if (!cv::imwrite(resultFilePath, cvBGRImage, compression_params))
- {
- return MEDIA_VISION_ERROR_INVALID_OPERATION;
- }
-
- return MEDIA_VISION_ERROR_NONE;
+ if (filePath == NULL || pDataBuffer == NULL)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+
+ static const std::string defaultFilePath = "out";
+ static const std::vector<std::string> jpgExtensions = getJPGExtensions();
+
+ bool rightExtensionFlag = false;
+
+ std::string resultFilePath(filePath);
+ if (resultFilePath.empty()) {
+ resultFilePath = defaultFilePath;
+ } else {
+ for (size_t extNum = 0; extNum < jpgExtensions.size(); ++extNum) {
+ if (resultFilePath.size() >= jpgExtensions[extNum].size()) {
+ std::string givenExtension = resultFilePath.substr(
+ resultFilePath.length() - jpgExtensions[extNum].size(),
+ jpgExtensions[extNum].size());
+
+ std::transform(
+ givenExtension.begin(), givenExtension.end(),
+ givenExtension.begin(), ::tolower);
+
+ if (givenExtension == jpgExtensions[extNum]) {
+ rightExtensionFlag = true;
+ break;
+ }
+ }
+ }
+ }
+ if (!rightExtensionFlag)
+ resultFilePath += jpgExtensions[0];
+
+ if (quality <= 0 || quality > 100)
+ quality = 100;
+
+ unsigned int width = imageData.imageWidth;
+ unsigned int height = imageData.imageHeight;
+
+ /* Type of conversion from given colorspace to BGR */
+ int conversionType = -1;
+ unsigned int channelsNumber = 0;
+ switch (imageData.imageColorspace) {
+ case MEDIA_VISION_COLORSPACE_INVALID:
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+ case MEDIA_VISION_COLORSPACE_Y800:
+ channelsNumber = 1;
+ conversionType = CV_GRAY2BGR;
+ break;
+ case MEDIA_VISION_COLORSPACE_I420:
+ channelsNumber = 1;
+ height *= 1.5;
+ conversionType = CV_YUV2BGR_I420;
+ break;
+ case MEDIA_VISION_COLORSPACE_NV12:
+ channelsNumber = 1;
+ height *= 1.5;
+ conversionType = CV_YUV2BGR_NV12;
+ break;
+ case MEDIA_VISION_COLORSPACE_YV12:
+ channelsNumber = 1;
+ height *= 1.5;
+ conversionType = CV_YUV2BGR_YV12;
+ break;
+ case MEDIA_VISION_COLORSPACE_NV21:
+ channelsNumber = 1;
+ height *= 1.5;
+ conversionType = CV_YUV2BGR_NV21;
+ break;
+ case MEDIA_VISION_COLORSPACE_YUYV:
+ channelsNumber = 2;
+ conversionType = CV_YUV2BGR_YUYV;
+ break;
+ case MEDIA_VISION_COLORSPACE_UYVY:
+ channelsNumber = 2;
+ conversionType = CV_YUV2BGR_UYVY;
+ break;
+ case MEDIA_VISION_COLORSPACE_422P:
+ channelsNumber = 2;
+ conversionType = CV_YUV2BGR_Y422;
+ break;
+ case MEDIA_VISION_COLORSPACE_RGB565:
+ channelsNumber = 2;
+ conversionType = CV_BGR5652BGR;
+ break;
+ case MEDIA_VISION_COLORSPACE_RGB888:
+ channelsNumber = 3;
+ conversionType = CV_RGB2BGR;
+ break;
+ case MEDIA_VISION_COLORSPACE_RGBA:
+ channelsNumber = 4;
+ conversionType = CV_RGBA2BGR;
+ break;
+ default:
+ return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
+ }
+
+ const int depth = CV_8U;
+ cv::Mat cvImage(cv::Size(width, height),
+ CV_MAKETYPE(depth, channelsNumber), pDataBuffer);
+ cv::Mat cvBGRImage;
+ cv::cvtColor(cvImage, cvBGRImage, conversionType);
+
+ std::vector<int> compression_params(2);
+ compression_params[0] = CV_IMWRITE_JPEG_QUALITY;
+ compression_params[1] = quality;
+
+ if (!cv::imwrite(resultFilePath, cvBGRImage, compression_params))
+ return MEDIA_VISION_ERROR_INVALID_OPERATION;
+
+ return MEDIA_VISION_ERROR_NONE;
}
int ImageHelper::destroyLoadedBuffer(unsigned char *pDataBuffer)
{
- if (!pDataBuffer) {
+ if (!pDataBuffer)
return MEDIA_VISION_ERROR_NONE;
- }
delete [] pDataBuffer;
pDataBuffer = NULL;
@@ -231,127 +214,118 @@ int ImageHelper::destroyLoadedBuffer(unsigned char *pDataBuffer)
}
int ImageHelper::drawRectangleOnBuffer(
- int topLeftVertexX,
- int topLeftVertexY,
- int bottomRightVertexX,
- int bottomRightVertexY,
- int thickness,
- const cv::Scalar& color,
- const ImageData& imageData,
- unsigned char *pDataBuffer)
+ int topLeftVertexX,
+ int topLeftVertexY,
+ int bottomRightVertexX,
+ int bottomRightVertexY,
+ int thickness,
+ const cv::Scalar& color,
+ const ImageData& imageData,
+ unsigned char *pDataBuffer)
{
- if (NULL == pDataBuffer)
- {
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
-
- cv::Mat cvImage(imageData.imageHeight, imageData.imageWidth, CV_8UC(OpenCVChannels), pDataBuffer);
- cv::rectangle(
- cvImage,
- cv::Point(topLeftVertexX, topLeftVertexY),
- cv::Point(bottomRightVertexX, bottomRightVertexY),
- color,
- thickness);
-
- return MEDIA_VISION_ERROR_NONE;
+ if (NULL == pDataBuffer)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+
+ cv::Mat cvImage(imageData.imageHeight, imageData.imageWidth, CV_8UC(OpenCVChannels), pDataBuffer);
+ cv::rectangle(
+ cvImage,
+ cv::Point(topLeftVertexX, topLeftVertexY),
+ cv::Point(bottomRightVertexX, bottomRightVertexY),
+ color,
+ thickness);
+
+ return MEDIA_VISION_ERROR_NONE;
}
int ImageHelper::drawQuadrangleOnBuffer(
- mv_quadrangle_s location,
- int thickness,
- const cv::Scalar& color,
- const ImageData& imageData,
- unsigned char *pDataBuffer)
+ mv_quadrangle_s location,
+ int thickness,
+ const cv::Scalar& color,
+ const ImageData& imageData,
+ unsigned char *pDataBuffer)
{
- if (NULL == pDataBuffer)
- {
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
-
- cv::Mat cvImage(imageData.imageHeight, imageData.imageWidth, CV_8UC(OpenCVChannels), pDataBuffer);
- for (int i = 0; i < QuadrangleVertices; ++i)
- {
- cv::line(
- cvImage,
- cv::Point(location.points[i].x, location.points[i].y),
- cv::Point(location.points[(i + 1) % QuadrangleVertices].x,
- location.points[(i + 1) % QuadrangleVertices].y),
- color,
- thickness);
- }
- return MEDIA_VISION_ERROR_NONE;
+ if (NULL == pDataBuffer)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+
+ cv::Mat cvImage(imageData.imageHeight, imageData.imageWidth, CV_8UC(OpenCVChannels), pDataBuffer);
+ for (int i = 0; i < QuadrangleVertices; ++i) {
+ cv::line(
+ cvImage,
+ cv::Point(location.points[i].x, location.points[i].y),
+ cv::Point(location.points[(i + 1) % QuadrangleVertices].x,
+ location.points[(i + 1) % QuadrangleVertices].y),
+ color,
+ thickness);
+ }
+ return MEDIA_VISION_ERROR_NONE;
}
int ImageHelper::convertBufferToRGB888(
- const unsigned char *pInBuffer,
- const ImageData& imageData,
- unsigned char **pOutBuffer)
+ const unsigned char *pInBuffer,
+ const ImageData& imageData,
+ unsigned char **pOutBuffer)
{
- // todo: support more colorspaces:
- switch (imageData.imageColorspace)
- {
- case MEDIA_VISION_COLORSPACE_Y800:
- return convertY800ToRGB(pInBuffer, imageData, pOutBuffer);
- case MEDIA_VISION_COLORSPACE_RGB888:
- {
- int numberOfComponents = 0;
- getNumberOfComponents(
- MEDIA_VISION_COLORSPACE_RGB888, &numberOfComponents);
- const int dataSize =
- imageData.imageHeight * imageData.imageWidth * numberOfComponents;
- (*pOutBuffer) = new unsigned char[dataSize];
- std::memcpy(*pOutBuffer, pInBuffer, dataSize);
- return MEDIA_VISION_ERROR_NONE;
- }
- default:
- return MEDIA_VISION_ERROR_NOT_SUPPORTED;
- }
-
- return MEDIA_VISION_ERROR_NOT_SUPPORTED;
+ /* todo: support more colorspaces: */
+ switch (imageData.imageColorspace) {
+ case MEDIA_VISION_COLORSPACE_Y800:
+ return convertY800ToRGB(pInBuffer, imageData, pOutBuffer);
+ case MEDIA_VISION_COLORSPACE_RGB888:
+ {
+ int numberOfComponents = 0;
+ getNumberOfComponents(
+ MEDIA_VISION_COLORSPACE_RGB888, &numberOfComponents);
+ const int dataSize =
+ imageData.imageHeight * imageData.imageWidth * numberOfComponents;
+ (*pOutBuffer) = new unsigned char[dataSize];
+ std::memcpy(*pOutBuffer, pInBuffer, dataSize);
+ return MEDIA_VISION_ERROR_NONE;
+ }
+ default:
+ return MEDIA_VISION_ERROR_NOT_SUPPORTED;
+ }
+
+ return MEDIA_VISION_ERROR_NOT_SUPPORTED;
}
int ImageHelper::getNumberOfComponents(
- mv_colorspace_e colorspace,
- int *pComponentsNumber)
+ mv_colorspace_e colorspace,
+ int *pComponentsNumber)
{
- // todo: support more colorspaces:
- switch (colorspace)
- {
- case MEDIA_VISION_COLORSPACE_Y800:
- (*pComponentsNumber) = 1;
- return MEDIA_VISION_ERROR_NONE;
- case MEDIA_VISION_COLORSPACE_RGB888:
- (*pComponentsNumber) = 3;
- return MEDIA_VISION_ERROR_NONE;
- default:
- return MEDIA_VISION_ERROR_NOT_SUPPORTED;
- }
-
- return MEDIA_VISION_ERROR_NOT_SUPPORTED;
+ /* todo: support more colorspaces: */
+ switch (colorspace) {
+ case MEDIA_VISION_COLORSPACE_Y800:
+ (*pComponentsNumber) = 1;
+ return MEDIA_VISION_ERROR_NONE;
+ case MEDIA_VISION_COLORSPACE_RGB888:
+ (*pComponentsNumber) = 3;
+ return MEDIA_VISION_ERROR_NONE;
+ default:
+ return MEDIA_VISION_ERROR_NOT_SUPPORTED;
+ }
+
+ return MEDIA_VISION_ERROR_NOT_SUPPORTED;
}
int ImageHelper::convertY800ToRGB(
- const unsigned char *pInBuffer,
- const ImageData& imageData,
- unsigned char **pOutBuffer)
+ const unsigned char *pInBuffer,
+ const ImageData& imageData,
+ unsigned char **pOutBuffer)
{
- if (imageData.imageColorspace != MEDIA_VISION_COLORSPACE_Y800)
- {
- return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
- const int inDataSize = imageData.imageHeight * imageData.imageWidth;
- int numberOfComponents = 0;
- getNumberOfComponents(MEDIA_VISION_COLORSPACE_RGB888, &numberOfComponents);
- const int dataSize = inDataSize * numberOfComponents;
- (*pOutBuffer) = new unsigned char[dataSize];
- for (int i = 0; i < inDataSize; ++i)
- {
- int pixelStartIndex = i*numberOfComponents;
- (*pOutBuffer)[pixelStartIndex] = pInBuffer[i];
- (*pOutBuffer)[pixelStartIndex+1] = pInBuffer[i];
- (*pOutBuffer)[pixelStartIndex+2] = pInBuffer[i];
- }
- return MEDIA_VISION_ERROR_NONE;
+ if (imageData.imageColorspace != MEDIA_VISION_COLORSPACE_Y800)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+
+ const int inDataSize = imageData.imageHeight * imageData.imageWidth;
+ int numberOfComponents = 0;
+ getNumberOfComponents(MEDIA_VISION_COLORSPACE_RGB888, &numberOfComponents);
+ const int dataSize = inDataSize * numberOfComponents;
+ (*pOutBuffer) = new unsigned char[dataSize];
+ for (int i = 0; i < inDataSize; ++i) {
+ int pixelStartIndex = i*numberOfComponents;
+ (*pOutBuffer)[pixelStartIndex] = pInBuffer[i];
+ (*pOutBuffer)[pixelStartIndex+1] = pInBuffer[i];
+ (*pOutBuffer)[pixelStartIndex+2] = pInBuffer[i];
+ }
+ return MEDIA_VISION_ERROR_NONE;
}
} /* namespace Common */
diff --git a/test/testsuites/common/image_helper/src/image_helper.cpp b/test/testsuites/common/image_helper/src/image_helper.cpp
index 825cd7a6..ad7cb886 100644
--- a/test/testsuites/common/image_helper/src/image_helper.cpp
+++ b/test/testsuites/common/image_helper/src/image_helper.cpp
@@ -54,18 +54,14 @@ int load_image_to_buffer(
image_data_s *image_data)
{
if (image_data == NULL)
- {
return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
int err;
ImageHelper::ImageData imageData;
err = ImageHelper::loadImageToBuffer(file_path, data_buffer, buffer_size, &imageData);
if (err == MEDIA_VISION_ERROR_NONE)
- {
*image_data = convertToCData(imageData);
- }
return err;
}
@@ -77,9 +73,7 @@ int save_image_from_buffer(
int quality)
{
if (image_data == NULL)
- {
return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
ImageHelper::ImageData imageData = convertToCppData(*image_data);
return ImageHelper::saveImageFromBuffer(file_path, data_buffer, imageData, quality);
@@ -101,9 +95,7 @@ int draw_rectangle_on_buffer(
unsigned char *data_buffer)
{
if (image_data == NULL)
- {
return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
ImageHelper::ImageData imageData = convertToCppData(*image_data);
@@ -125,9 +117,7 @@ int draw_quadrangle_on_buffer(
unsigned char *data_buffer)
{
if (image_data == NULL)
- {
return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
ImageHelper::ImageData imageData = convertToCppData(*image_data);
@@ -147,9 +137,7 @@ int convert_buffer_to_RGB888(
unsigned char **out_buffer)
{
if (image_data == NULL)
- {
return MEDIA_VISION_ERROR_INVALID_PARAMETER;
- }
ImageHelper::ImageData imageData = convertToCppData(*image_data);
return ImageHelper::convertBufferToRGB888(in_buffer, imageData, out_buffer);