image processing

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 4739 Views - Last Post: 03 January 2013 - 05:12 AM Rate Topic: -----

#16 defunktlemon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 29-November 10

Re: image processing

Posted 02 January 2013 - 03:54 PM

View Postkaa, on 19 December 2012 - 10:47 PM, said:

You'll probably find the CImg Library easier to use. To use it with jpeg files, you'll also have to install ImageMagick (which serves as a "helper application" for CImg), but I think you'll find all of the functions you need in the CImg Class.

The CImg page also has a link to a simple tutorial.


kaa - I have installed library and run the "Hello World" program successfully. I am having problems with the other tutorial which I think may be related to a bad registry. I am installing Windows 8 tonight, which should fix the problem. CImg works ok with Win 8 and Visual Studio 2012. I mean, it's just a library, right, so should be no problem?

oh wait. I just thought when I saw your original post in my reply - I haven't installed ImageMagick which I think is necessary for that tutorial. Anyway - my original question still stands please.
Was This Post Helpful? 0
  • +
  • -

#17 defunktlemon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 29-November 10

Re: image processing

Posted 03 January 2013 - 05:12 AM

Quote

2. I need to align the images

All you need is to load the two images into two separate (equally sized) arrays. This will be enough to "align" the images in memory. You could then have a third array (also equally sized) and have that represent your difference image.

i.e.
#include <stdio.h>
#include <stdlib.h>

#define IMAGE_SIZE 640 * 480

int main() {
   unsigned char imageA[IMAGE_SIZE] = {0};
   unsigned char imageB[IMAGE_SIZE] = {0};
   unsigned char diffImage[IMAGE_SIZE] = {0};
   int ndx;
   
   //load image files into arrays
   
   for(ndx = 0; ndx < IMAGE_SIZE; ndx++) {
      //get absolute difference for each pixel
      diffImage[ndx] = abs(imageA[ndx] - imageB[ndx]);
   }
   
   return 0;
}



@jjl - So, you are saying that I don't need any pre-built libraries from OpenCV, ect, all I need is some simple C code, like that you have shown here? I don't need to worry about trying to code that very difficult example to input and display images, given to me from outside forum?
So, this code will work out the difference of both images, each in the respective arrays, and all I just need to go on to display the differenced image from there? I do only need to show the differenced image and not the original two, actually.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2