60 426
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #4024 in C++ for suesue

Question #4024
Hello. The aim of this program is to load images in sequence like a video. I tried running this program but an error occurred at cvWriteFrame. Can you tell me what is wrong with my codes? Thank you in advance.


#include "cv.h"
#include "highgui.h"
#include "conio.h"
#include "stdio.h"



int main( ) {

double fps=20;
CvSize size = cvSize(320,240);
IplImage *image=cvLoadImage("1.jpg",1);


if(image==NULL ) {
puts("unable to load the frame");getch();exit(0);}


CvVideoWriter* writer = cvCreateVideoWriter("Video from Images.avi",CV_FOURCC('D','I','V','X'),fps,size);

for(int counter=0;counter < 300;counter++)
{
printf("Enteredn");
cvWriteFrame( writer, image);

}

image=cvLoadImage("2.jpg",1);

if(image==NULL ) {

puts("unable to load the second frame");cvWaitKey(0);exit(0);}

for(int counter=0;counter < 300;counter++)
{
printf("Entered-2nd-loop");

cvWriteFrame( writer,image);
} cvWaitKey(0);

cvReleaseVideoWriter( &writer );

cvReleaseImage( &image );
return 0;
}

Expert's answer
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions