verifying image compression

This is a discussion on verifying image compression within the C++ Programming forums, part of the General Programming Boards category; I have a program that compresses an image by blurring out everything outside of a circular area, how would I ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    106

    verifying image compression

    I have a program that compresses an image by blurring out everything outside of a circular area, how would I verify that this circular region has been unaltered? I'm using JasPer and CImg libraries.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,742
    Is your image file format a lossy compression like .JPG, in which case you're hosed.

    Or is it a loss-less compression like .PNG, in which case, you could say XOR both images together and see if you end up with a big black circle.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    106
    I wrote a super detailed post but this forum logged me out when i hit reply, when i went back it was gone (god damnit).

    jp2 allows you to do lossless compression on a specified area of a picture. I have an 'area of interest' in a .tif image that gets the lossless compress (jp2 guarantees lossless but I need to have a program that also demonstrates this). Everything outside of the area of interest gets a lossy compression. I have two nested for loops that loop through each pixel in the image and I get the same value for each (even though the pixels have different values in the pictures. Here is the list of all commands, see the section for image information (about 1/6th down the page). I think they way I'm supposed to check the value of a pixel is by using img(x,y), where img is the image using their class, x and y specify the coordinate of the pixel. I am not sure I'm using this correctly. According to their documentation its supposed to return T & type. img(x,y) produces the same result as img.at(x,y). How would I get the value of a pixel in an image. I'm having trouble understand their library, perhaps someone could enlighten me, there is not much reading - the hard part is making sense of it. They give the following example:

    CImg<float> img(100,100,1,1,0); // Define a 100x100 greyscale image
    float *ptr = ptr(10,10); // Get a pointer to the pixel located at (10,10).
    float val = *ptr; // Get the pixel value.

    How can they have a ptr and a function with the same name? Perhaps they made a mistake and meant to write img(10,10) instead of ptr(10,10).

    I have tried to make my program to cout img1(x,y) == img2(x,y), or !=, but cannot get their library to return the value of a pixel

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 05:17 AM
  2. Replies: 1
    Last Post: 05-27-2009, 01:46 PM
  3. Simple Image Processing
    By ejohns85 in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2009, 01:10 PM
  4. Image Loading Troubles
    By frenchfry164 in forum C++ Programming
    Replies: 3
    Last Post: 11-02-2003, 01:07 PM
  5. Replies: 4
    Last Post: 03-02-2003, 09:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21