Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6851055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:12:03+00:00 2026-05-27T01:12:03+00:00

This is a continuation question from Opencv video frame giving me an error I

  • 0

This is a continuation question from
Opencv video frame giving me an error
I think I closed it off, Im new to Stackoverflow.

I have code below that Im trying to see its Sobel edge image. However the program runs but the output is just a grey screen where if I mouseover the cursor disappears.
Does anyone see the error? or is it a misunderstanding about the data structures Im using

IplImage *frame, *frame_copy = 0;

// capture frames from video
CvCapture *capture = cvCaptureFromFile( "lightinbox1.avi");
//Allows Access to video propertys
cvQueryFrame(capture);

//Get the number of frames
int nframe=(int) cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_COUNT);

//Name window
cvNamedWindow( "video:", 1 );

//start loop
for(int i=0;i<nframe;i++){
//prepare capture frame extraction
cvGrabFrame(capture);
cout<<"We are on frame "<<i<<"\n";
//Get this frame
frame = cvRetrieveFrame( capture );
con2txt(frame);
frame_copy = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,frame->nChannels );
//show and destroy frame
cvCvtColor( frame,frame,CV_RGB2GRAY);

 //Create Sobel output
 frame_copy1 = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_16S,1 );
cvSobel(frame_copy,frame_copy1,2,2,3);

cvShowImage("video:",frame_copy1);
cvWaitKey(33);}
cvReleaseCapture(&capture);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:12:04+00:00Added an answer on May 27, 2026 at 1:12 am

    In this case, I think it’s because you are creating a destination image with different depth than the original:

    frame_copy1 = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_16S,1 );
    

    and you should be doing:

    frame_copy1 = cvCreateImage(cvSize(frame->width,frame->height),IPL_DEPTH_8U,1 );
    

    Anyway, this post shows an example that uses cvSobel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a continuation question from a previous question I have asked I now
This is a continuation from a previous stackoverflow question. I've renamed some variables so
This is a continuation from the previous stackoverflow jQuery question I asked, but I
Ok - this is in continuation from my earlier question about sending an email
This is a continuation of the question here: JBoss - does app have to
A continuation from this question I need a SQL statement that returns the number
this is a continuation from a previous JQueryUI Autocomplete question, I asked . This
So this is a continuation from my last question - So the question was
Fairly rubbish with PHP, this is a continuation on from my last question .
This is a continuation question I had from a post yesterday: Initializing NSMutableDictionary (It's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.