[coding convention] Fixed coding rule violation 70/76170/2 accepted/tizen/common/20160629.222214 accepted/tizen/ivi/20160629.015910 accepted/tizen/mobile/20160629.015826 accepted/tizen/tv/20160629.015927 accepted/tizen/wearable/20160629.015956 submit/tizen/20160627.065544
authorTae-Young Chung <ty83.chung@samsung.com>
Thu, 23 Jun 2016 04:55:31 +0000 (13:55 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Thu, 23 Jun 2016 04:59:52 +0000 (13:59 +0900)
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>
mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp
mv_face/face/src/FaceRecognitionModel.cpp
mv_image/image/src/Features/FeatureMatcher.cpp
mv_image/image/src/Features/ORBExtractorFactory.cpp
mv_image/image/src/Tracking/MFTracker.cpp
packaging/capi-media-vision.spec
test/testsuites/common/image_helper/src/ImageHelper.cpp
test/testsuites/common/image_helper/src/image_helper.cpp

index ddf552e..493f68e 100644 (file)
@@ -446,7 +446,6 @@ int mv_barcode_generate_image_open(
                value = bgcolour[1];
                bgcolour[1] = bgcolour[5];
                bgcolour[5] = value;
-
        }
 
        error = BarcodeGenerator::generateBarcodeToImage(
index 3686342..b8ae24b 100644 (file)
@@ -191,7 +191,6 @@ FaceRecognitionModel::~FaceRecognitionModel()
 int FaceRecognitionModel::save(const std::string& fileName)
 {
        if (!m_recognizer.empty()) {
-
                std::string filePath;
 
                filePath = fileName;
index 0d00d10..74b4312 100644 (file)
@@ -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;
 
index 2ac5d81..8ac34df 100644 (file)
@@ -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;
index d2674b0..df7f2a7 100644 (file)
@@ -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) {
index c0ce93a..8707ca1 100644 (file)
@@ -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
index 7e13206..6d03b9d 100644 (file)
@@ -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 */
index 825cd7a..ad7cb88 100644 (file)
@@ -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);