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

  • SEARCH
  • Home
  • 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 4266182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:43:32+00:00 2026-05-21T06:43:32+00:00

I can’t understand why Iplimage received from video and from file (received from this

  • 0

I can’t understand why Iplimage received from video and from file (received from this video) contain different pixels value. This code show it.

CvCapture* readerAvi = cvCreateFileCapture( "input.avi" );
//  Grad first frame from input video stream
if(!cvGrabFrame(readerAvi)) {           
    std::cerr << "Could not grab AVI frame." << std::endl;
    return 0;
}
IplImage* videoFrame = cvRetrieveFrame(readerAvi); 
if( !videoFrame )
    break;

// Save values of some pixels in file
std::ofstream fout("frame_pixels.txt"); 
for(int y = 170; y < 270; ++y) {
    for(int x = 30; x < 130; ++x) {
        CvScalar s = cvGet2D(videoFrame, y, x );
        fout << "x=" << x << " y=" << y << " " << s.val[0] << " " << s.val[1] << " " << s.val[2] << std::endl;
    }
    fout << "\n";
}
fout.close();
cvSaveImage("temp.jpg", videoFrame);

// Load saved image
videoFrame = cvLoadImage("temp.jpg");
fout.open("image_pixels.txt");  

// Save values of some pixels in file
for(int y = 170; y < 270; ++y) {
    for(int x = 30; x < 130; ++x) {
          CvScalar s = cvGet2D(videoFrame, y, x );                  
          fout << "x=" << x << " y=" << y << " " << s.val[0] << " " << s.val[1] << " " << s.val[2] << std::endl;

          }
    fout << "\n";
    }
fout.close();

So why files frame_pixels.txt and image_pixels.txt contain near numbers but not the same?

  • 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-21T06:43:32+00:00Added an answer on May 21, 2026 at 6:43 am

    I can’t say for sure without seeing the data itself, but it’s very likely to be down to compression undergone by the image. If the video came from a set of images, then each of those images will have gone through a second compression when the video was created – e.g. JPEG compression in the case of MPEG files (more details here). This will cause artefacts on the image. If the image is a still frame taken from the video, when it was saved, it may well have undergone compression.

    Whilst the video frame and the still image may look comparable by eye, there’s almost certainly going to be slight differences as a result of the way images are compressed.

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

Sidebar

Related Questions

can someone explain why the compiler accepts only this code template<typename L, size_t offset,
can someone show me the regex for this preg_match. I want to make sure
Does anyone know how can I replace this 2 symbol below from the string
can any one tell me how can change this java code into objective c.is
Can anyone recommend a good library for generating an audio file, such as mp3,
Can I run this in a Windows command prompt like I can run it
Can anybody help me? What should be the datatype for this type -07:00:00 of
Can you guys help me understand a concept real quick, I'm having trouble understanding
Can't figure out how to do this in a pretty way : I have
Can MOSS integrate and get user profiles from multiple Active Directory and/or LDAP stores?

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.