Ask Your Question

OpenCV Crash Issue when using in xcode

asked 2012-12-10 03:09:02 -0600

srinu ambati gravatar image

updated 2012-12-10 03:30:43 -0600

I am doing a iOS App to detect the circles and squares in an image . For that I am using the openCV link . When I compile it it is crashing at the this line

  int iheight = 460;
int jwidth = 320;

if( (data[istep+jchannels+0] > 200) && (data[istep+jchannels+1] > 200) && (data[istep+jchannels+2] > 220) )` Please help me , Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-10 04:35:36 -0600

bjoernz gravatar image

You need to change

  • for(int i=0;iheight;i=i++) to for(int i=0; i < img->height; i++) and
  • for(int j=0;jwidth;j++) to for(int j=0; j < img->width; j++).

<img-> was incorrectly identified as a HTML tag and because the browser does not understand that tag, it ignores it.

Generally, you should try to understand the source code, that you are trying to compile :-).

BTW: In case of inexplicable crashes:

  1. Assume, you are accessing a resource, that has not been initialized yet.
  2. Prove the assumption to be wrong.
  3. Assume, you are accessing an array beyond its bounds.
  4. Prove the assumption to be wrong.
  5. ...
edit flag offensive delete link more


Thank you bjoemz. Last doubt is Whatever Image I am passing it is giving the output as square. Please help me . Thanks in advance.

srinu ambati gravatar imagesrinu ambati ( 2012-12-10 05:27:25 -0600 )edit

Question Tools


Asked: 2012-12-10 03:09:02 -0600

Seen: 272 times

Last updated: Dec 10 '12