0

The following code gives seg fault and some time stalls/hangs and never works.

for(i=0;i<360;i++)

{

CVrotate(image, i); //i is angle


display("image" in some window);  

}

but the following work very well.

 for(i=0;i<360;i++)

 {

 CVrotate(image, i); //i is angle

 waitkey(10);

 display("image" in some window);  
 }

Cvrotate is a function that is rotating an image, and the rotated image is being displayed by the opencv function for displaying.

Why is waitkey(); needed here? I understand that the display should be called only after CVrotate is done with its job. Similarly, I am assuming that the next iteration starts when the display is over and not before that. Please enlighten me.

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
gpuguy
  • 4,607
  • 17
  • 67
  • 125
  • If every thing is given in tutorial probably SO would not have come into existence!! I just read the SO FAQ, did not find any place where it says "I can not ask about 10 questions in last two days on Opencv" – gpuguy Jun 20 '12 at 11:05
  • 1
    Before asking a question you have to find (Google) similar questions to yours and understand the problem you faced. After this you have to fix/find solution by yourself. But you're just blindly asking a questions. I alerady give you a pointer to the answer - did you find a solution? – ArtemStorozhuk Jun 20 '12 at 11:22
  • Oh Yes, your answer was helpful. – gpuguy Jun 20 '12 at 11:26

1 Answers1

2

What does OpenCV's cvWaitKey( ) function do? this link clears all the misconceptions regarding the cvWaitkey and its uses .Hope this is useful for you. cvWaitKey's main function is to pause the code for a while.

Community
  • 1
  • 1
nbsrujan
  • 1,179
  • 1
  • 12
  • 26
  • Reading the original specification Doc did not help me. but this one is now clear to me. Thanks – gpuguy Jun 20 '12 at 11:17