Ask Your Question

@boom's profile - activity

2020-12-29 01:56:34 -0600 received badge  Popular Question (source)
2019-01-05 01:01:54 -0600 received badge  Notable Question (source)
2018-04-30 02:42:35 -0600 received badge  Popular Question (source)
2017-08-22 09:11:01 -0600 received badge  Student (source)
2016-11-10 23:50:17 -0600 commented answer crack detect red line opencv

@pklab Thanks It worked fine after editing and debugging. I will oblige you if give me some small hint of this code mean Algorithms used in it or something like this.

2016-10-17 05:01:25 -0600 commented answer crack detect red line opencv

hello sir, i investigate the code and yeah!! it shows me one error now as drawMarker was not declare in this scope, i added highgui.hpp and imgproc.hpp as weel but it shows the error. When i remove 2.0 from this then i got no error except this drawmarker Point2f pt0 = (rect_points[0] + rect_points[3]) / 2.0; Point2f pt1 = (rect_points[1] + rect_points[2]) / 2.0; Point2f pt2 = (rect_points[0] + rect_points[1]) / 2.0; Point2f pt3 = (rect_points[2] + rect_points[3]) / 2.0;

2016-09-20 00:36:26 -0600 commented answer crack detect red line opencv

@pklab i update the opencv but still same things.this time not error but some NOTE like /usr/include/c++/valarray :note template class........something like this . am i compiling it right as g++ -ggbd 'pkg-config' --cflags --libs opencv' <filename> -o object and point2f pt3 =(rect_points[2] +rect_points[3] /2.0); is common in every line

2016-09-18 23:03:17 -0600 commented answer crack detect red line opencv

Ok sir thanks for your kind help......i will investigate it if error occurs i will ask you also updating my opencv

2016-09-16 05:38:40 -0600 commented answer crack detect red line opencv

@pklab it shows error in Morph. morph was not declared in this scope

2016-09-16 01:14:41 -0600 commented question crack detect red line opencv

@berak dear berak i don't know why my compiler not reading vector<> i have example code of opencv also have vector. i also shows the errors. i have done with it but nothing happens

include<vector>

2016-09-16 00:17:55 -0600 received badge  Supporter (source)
2016-09-15 23:04:04 -0600 commented answer crack detect red line opencv

@pklab Thanks very much i am really oblige you. Ok i will implement it if any problem occurs i will ask you.

2016-09-14 23:08:01 -0600 commented answer crack detect red line opencv

@v4ven27 thanks sir But i want to know how to use lines.size() simply. i don't know how to use it because i m new in opencv

2016-09-14 04:32:46 -0600 commented question crack detect red line opencv

@pklab i edit the original image i don't bother about corner crack

2016-09-14 04:32:02 -0600 commented question crack detect red line opencv

@berak line.size().i didn't find any function in opencv and how to use it

2016-09-14 00:57:33 -0600 asked a question crack detect red line opencv

i want to make a decision making process of detection of biscuit crack so i used the hough transform for detection of crack. here is the code. It means counting the red pixels,if present then say as crack and if not present say no crack simply. One more thing i want to measure the size of my biscuit.

Mat src = imread("/home/pi/Desktop/pics/grey.jpg");

Mat dst, cdst,pic;


 Canny(src, dst, 30, 160, 3);
cvtColor(dst, pic, CV_GRAY2BGR);
imwrite("/home/pi/Desktop/pics/bisgry.jpg",pic);
// imshow("source",pic);
cdst=~pic;


vector<Vec2f> lines;
HoughLines(dst, lines, 1, CV_PI/180,33 ,1, 1 );

for( size_t i = 0; i < lines.size(); i++ )
{
float rho = lines[i][0], theta = lines[i][1];
Point pt1, pt2;
double a = cos(theta), b = sin(theta);
double x0 = a*rho, y0 = b*rho;
pt1.x = cvRound(x0 + 1000*(-b));
pt1.y = cvRound(y0 + 1000*(a));
pt2.x = cvRound(x0 - 1000*(-b));
pt2.y = cvRound(y0 - 1000*(a));
line( cdst, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
}

  /*vector<Vec4i> lines;
  HoughLinesP(dst, lines, 1, CV_PI/180, 50, 50, 10 );
  for( size_t i = 0; i < lines.size(); i++ )
  {
  Vec4i l = lines[i];
   line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,0,255), 3, CV_AA);
   }*/

 [enter image description here][1] imshow("source", src);
 imshow("source1",pic);
imshow("detected lines", cdst);
imwrite("/home/pi/Desktop/pics/cracked.jpg",cdst);

waitKey(); image description image description

@pklab there are the error sir i added headers imgproc.h,highgui.h,opencv2.h

pi@raspberrypi:~/Desktop $ g++ -ggdb `pkg-config --cflags --libs opencv` blob.cpp -o bolb

Ok i again run the code by including namespace cv and std but these are the errors. please give me some hints so that i can improve. i am learner and student not professional sir.

    alarray<_Tp>’
     Point2f pt1 = (rect_points[1] + rect_points[2]) / 2.0;
                                                       ^
      In file included from /usr/include/opencv2/contrib/retina.hpp:76:0,
             from /usr/include/opencv2/contrib/contrib.hpp:979,
             from /usr/local/include/opencv2/opencv.hpp:59,
             from crackb.cpp:5:
             /usr/include/c++/4.9/valarray:1170:1: note:   template argument deduction/substitution failed:
               crackb.cpp:118:59: note:   mismatched types ‘const std::valarray<_Tp>’ and ‘double’
               Point2f pt1 = (rect_points[1] + rect_points[2]) / 2.0;
               file included from /usr/local/include/opencv2/core/core.hpp:4884:0,
             from /usr/local/include/opencv2/highgui/highgui.hpp:46,
             from crackb.cpp:2:
              /usr/local/include/opencv2/core/mat.hpp:1301:20: note: cv::MatExpr cv::operator/(const                                  
              CV_EXPORTS MatExpr operator / (const MatExpr& e1, const MatExpr& e2);
                ^
              /usr/local/include/opencv2/core/mat.hpp:1301:20: note:   no known conversion for argument 1 from              ‘cv::Point_<float>’ to ‘const cv::MatExpr&’
          /usr/local/include/opencv2/core/mat.hpp:1300:20: note: cv::MatExpr cv::operator/(double, const    cv::MatExpr&)
              CV_EXPORTS MatExpr operator / (double s, const MatExpr& e);
                ^
             /usr/local/include/opencv2/core/mat.hpp:1300:20: note:   no known conversion for argument 1 from ‘cv::Point_<float ...
(more)
2016-09-06 04:18:54 -0600 commented question crack detection

SO tell me your email id so i can mail it to you sir. i don't understand what the houghlines() function returns. So if i stores the values and make decision

2016-08-23 01:20:48 -0600 asked a question crack detection

Hello there i used the thresolimage descriptionding techniques(thresold TOZERO) of my biscuit image and used canny edge detection. After then i used hough transform of it. it detect the biscuit crack. Now i want to make it decision based mean if crack in biscuit is detected it tells Detected in my terminal. So i want to know what is the function returns and how to do this. Please reply. Here is the example image in this image u can see red line which detects the crack. if somehow i adjust to findout not by seeing image that image is crack ..like counting red pixels .if presents mean image is crack.

2016-08-23 01:18:35 -0600 commented question Hough Transform

Hello there i used the thresolding techniques(thresold TOZERO) of my biscuit image and used canny edge detection. After then i used hough transform of it. it detect the biscuit crack. Now i want to make it decision based mean if crack in biscuit is detected it tells Detected in my terminal. So i want to know what is the function returns and how to do this. Please reply.

2016-08-17 01:13:52 -0600 commented answer Opencv error

Yes command run correct but again no change in o/p while compiling the code. In opencv docs there is command but when i run it Here is the error. CMake Error: The source directory "/home/sachin/Desktop/pics" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. THIS IS THE COMMAND cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/home/sachin/opencv /home/sachin/opencv is the folder path and /usr/local/include/opencv2 is my library path

2016-08-17 00:54:47 -0600 commented answer Opencv error

cmake -DBUILD_JPEG -DBUILD_TIFF -DBUILD_PNG Parse error in command line argument: -DBUILD_JPEG Should be: VAR:type=value CMake Error: No cmake script provided. CMake Error: Problem processing arguments. Aborting.

2016-08-17 00:50:40 -0600 commented question Opencv error

Sir how can i do it i see all steps of installation from http://docs.opencv.org/2.4/doc/tutori...

2016-08-16 07:08:45 -0600 commented question Hough Transform

Hello Berak i have one biscuit image captured from camera using opencv now i am detecting lines in the pic so i used haughline transform but line is not detected mean output is coming but the red lines where crack is, not coming.i can send you a pic,,and code is from http://opencvexamples.blogspot.com/20...

2016-08-16 06:13:10 -0600 commented question Opencv error

sir i actually update my system after that it is not running.

2016-08-16 02:16:23 -0600 commented answer Close camera after two seconds

sir this code iis ok with ubuntu but while i run it on raspberry pi it gives error like videoc_dqbuf: no such devices

2016-08-16 01:24:26 -0600 asked a question Opencv error

Hello There i have opencv in my ubuntu platform .Today i started it and comile the programme but it tells many error while compiling it. Here it is

sachin@sachin-desktop:~/Desktop$ g++ `pkg-config --cflags opencv` haugh.cpp -o haugh `pkg-config --libs opencv`


/usr/bin/ld: warning: libjpeg.so.62, needed by /usr/local/lib/libopencv_imgcodecs.so, not found (try using -rpath or -rpath-link)
/usr/lib/libtiff.so.4: undefined reference to `jpeg_read_raw_data'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_resync_to_restart'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_std_error'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_CreateDecompress'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_start_compress'
/usr/lib/libjasper.so.1: undefined reference to `jpeg_default_colorspace'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_set_quality'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_read_header'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_alloc_huff_table'
/usr/lib/libtiff.so.4: undefined reference to `jpeg_write_raw_data'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_destroy_decompress'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_stdio_dest'
/usr/lib/libtiff.so.4: undefined reference to `jpeg_destroy'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_calc_output_dimensions'
/usr/lib/libtiff.so.4: undefined reference to `jpeg_abort'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_finish_compress'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_destroy_compress'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_finish_decompress'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_set_defaults'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_start_decompress'
/usr/lib/libtiff.so.4: undefined reference to `jpeg_suppress_tables'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_write_scanlines'
/usr/lib/libtiff.so.4: undefined reference to `jpeg_set_colorspace'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_CreateCompress'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_read_scanlines'
/usr/lib/libtiff.so.4: undefined reference to `jpeg_write_tables'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_simple_progression'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_stdio_src'
collect2: ld returned 1 exit status
2016-08-09 23:34:30 -0600 commented question Back ground substraction image

Can this do the segment of image like background substraction. Mean i have to fix the Background first and take the picture and apply absdiff(bg,fg);because i want to totally black my background because neglating the effect of light while taking the picture with camera

2016-08-09 23:31:18 -0600 received badge  Enthusiast
2016-08-05 02:07:37 -0600 commented question Back ground substraction image

Sir i have actually cracked round biscuit i want to detect the crack it it. so first do it background substaction of image for segment then thresholding of this image. now use haugh line transform. but i am segment the image here with watershad algo. but results is not coming. Actually i am Newbie in image Processing And i ma from electric engg. this is my Project work. i am learning it.

2016-08-05 00:40:36 -0600 commented question Back ground substraction image

The question is how can i give input while run code as ./bs_a -img p.jpg it shows error. i only want to background sub. of only 1 image.

2016-08-04 06:14:10 -0600 asked a question Back ground substraction image

Hello there i am begineer in image processing as well as coding. i am doing background substaction of image for segmentation.so i get code from opencv decs. here it is

/** * @file bg_sub.cpp * @brief Background subtraction tutorial sample code * @author Domenico D. Bloisi */

//opencv #include "opencv2/imgcodecs.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/videoio.hpp" #include <opencv2 highgui.hpp=""> #include <opencv2 video.hpp=""> //C #include <stdio.h> //C++ #include <iostream> #include <sstream>

  using namespace cv;
  using namespace std;

 // Global variables
Mat frame; //current frame
Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method
Ptr<BackgroundSubtractor> pMOG2; //MOG2 Background subtractor
int keyboard; //input from keyboard

/** Function Headers */
void help();
void processVideo(char* videoFilename);
void processImages(char* firstFrameFilename);

void help()
{
cout
<< "--------------------------------------------------------------------------" << endl
<< "This program shows how to use background subtraction methods provided by "  << endl
<< " OpenCV. You can process both videos (-vid) and images (-img)."             << endl
                                                                                << endl
<< "Usage:"                                                                     << endl
<< "./bs {-vid <video filename>|-img <image filename>}"                         << endl
<< "for example: ./bs -vid video.avi"                                           << endl
<< "or: ./bs -img /data/images/1.png"                                           << endl
<< "--------------------------------------------------------------------------" << endl
<< endl;

}

/* * @function main */ int main(int argc, char argv[]) { //print help information help();

//check for the input parameter correctness
if(argc != 3) {
    cerr <<"Incorret input list" << endl;
    cerr <<"exiting..." << endl;
    return EXIT_FAILURE;
}

//create GUI windows
namedWindow("Frame");
namedWindow("FG Mask MOG 2");

//create Background Subtractor objects
pMOG2 = createBackgroundSubtractorMOG2(); //MOG2 approach

if(strcmp(argv[1], "-vid") == 0) {
    //input data coming from a video
    processVideo(argv[2]);
}
else if(strcmp(argv[1], "-img") == 0) {
    //input data coming from a sequence of images
    processImages(argv[2]);
}
else {
    //error in reading input parameters
    cerr <<"Please, check the input parameters." << endl;
    cerr <<"Exiting..." << endl;
    return EXIT_FAILURE;
}
//destroy GUI windows
destroyAllWindows();
return EXIT_SUCCESS;

}

/* * @function processVideo */ void processVideo(char videoFilename) { //create the capture object VideoCapture capture(videoFilename); if(!capture.isOpened()){ //error in opening the video input cerr << "Unable to open video file: " << videoFilename << endl; exit(EXIT_FAILURE); } //read input data. ESC or 'q' for quitting while( (char)keyboard != 'q' && (char)keyboard != 27 ){ //read the current frame if(!capture.read(frame)) { cerr << "Unable to read next frame." << endl; cerr << "Exiting..." << endl; exit(EXIT_FAILURE); } //update the background model pMOG2->apply(frame, fgMaskMOG2); //get the frame number and write it on the current frame stringstream ss; rectangle(frame, cv::Point(10, 2), cv::Point(100,20), cv::Scalar(255,255,255), -1); ss << capture.get(CAP_PROP_POS_FRAMES); string frameNumberString = ss.str(); putText(frame, frameNumberString.c_str(), cv::Point(15, 15), FONT_HERSHEY_SIMPLEX, 0.5 , cv::Scalar(0,0,0)); //show the current frame and the fg masks imshow("Frame", frame); imshow("FG Mask MOG 2", fgMaskMOG2); //get the input from the keyboard keyboard = waitKey( 30 ); } //delete capture object capture.release(); }

/* * @function processImages */ processImages(char fistFrameFilename) { //read the first file of the sequence frame = imread(fistFrameFilename); if(frame.empty()){ //error in opening the first image cerr << "Unable to open first image frame: " << fistFrameFilename << endl; exit(EXIT_FAILURE); } //current image filename string fn(fistFrameFilename); //read input data. ESC or 'q' for quitting while( (char)keyboard != 'q' && (char)keyboard != 27 ){ //update the background model pMOG2- ... (more)

2016-08-03 06:37:42 -0600 commented question Capturing image and segment

i does mean that camera is opening and taking picture and segment it and save segment image but camera is running .My camera light is on.

2016-08-03 04:38:46 -0600 asked a question Capturing image and segment

Hello There i want to segment image which is capture from cam so here is the code i wrote with help of @berak.

#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;
using namespace std;
///////////////////////////////////////////image capture and stop camera//////////////////////////////
int main(int, char**)

{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;

    Mat frame; // keep it out of the loop, so we can save latest img.
    int64 t0 = getTickCount(); // start time
    for(;;)
    {
        cap >> frame; // get a new frame from camera
        int64 t1 = getTickCount(); // time now
        double timeRunning = double(t1-t0)/getTickFrequency();
        if (timeRunning >= 1.0) // 2 seconds
              break;
    }
    // write last frame to  disk:
    imwrite("/home/sachin/Desktop/a.jpg", frame);
    // the camera will be deinitialized automatically in VideoCapture destructor

////////////////////////////////////Adaptive segmentation /////////////////////////////

Mat src,dst,img;
   img = imread("/home/sachin/Desktop/a.jpg"); //read the image data in the file "MyPic.JPG" and store it in 'img'

if (img.empty()) //check whether the image is loaded or not
{
cout << "Error : Image cannot be loaded..!!" << endl;
          //system("pause"); //wait for a key press
return -1;
}
cvtColor(img,src,CV_BGR2GRAY);
//cvtColor( src, src_gray, CV_BGR2GRAY );
adaptiveThreshold(src,dst,230,ADAPTIVE_THRESH_MEAN_C,THRESH_BINARY ,5,2);

namedWindow("Adaptive", CV_WINDOW_NORMAL); //create a window with the name "MyWindow"
imshow("Adaptive", dst); //display the image which is stored in the 'img' in the "MyWindow" window

waitKey(0); //wait infinite time for a keypress

     destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"
    return 0;
}

here camera capture the image and segment the image but camera can't stop. please help me out.

2016-08-03 00:51:59 -0600 received badge  Editor (source)
2016-08-03 00:47:06 -0600 marked best answer Close camera after two seconds

Hello there i am newbie in opencv. i am doing with camera capturing nd got the code from some google source. i understood the code.

#include "opencv2/opencv.hpp"

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
        return -1;

    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera
        // do any processing
        imwrite("/home/sachin/Desktop/a.jpg", frame);
        if(waitKey(1) >= 0) break;   // you can increase delay to 2 seconds here

cap.release(); } // the camera will be deinitialized automatically in VideoCapture destructor return 0; }

here camera capture the image while I press ctrl+c. but i want to do it as automatically close the camera in 2 second. i don't how to close camera . please help me anticipation of your help.