1 Reply Latest reply on Jul 16, 2015 6:37 PM by JPMontero_Intel

    I am trying to do object detection with galileo gen2 board. when i try to see the image in the sd card i get a invalid image  even though the image is saved as mentioned in the program.


      The code is as folllows



      #include <stdio.h>

      #include <opencv2/opencv.hpp>

      #include <math.h>

      using namespace cv;

      int main(int argc, char *argv[])


      Mat image;

      VideoCapture cap(0);




      printf("No image");


      if (!image.empty())





               printf("image captured");

              //convert RGB image into HSV image 

              cvtColor(image, hsv, CV_BGR2HSV); 


              //get binary image 

              inRange(hsv, Scalar(157, 72, 156), Scalar(180, 169, 255), binary); 


              //find contours from binary image 

              int i; 

              vector< vector<Point> > contours; 

              findContours(binary, contours, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE); //find contours 






      imwrite("webcam_image.jpg", image);

      return 0;






      please tell me if the code is correct. i get no errors but i am willing to see a saved binary image with contour marked. this works in code blocks....but in putty after copying the image to the sd card invalid image it says.