Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

PSNR- increasing performance and some questions

Hi all,
im working on new project called PSNR-  objective video estimator. I made something like beta program, which is counting PSNR values for every single frame( for all three channels R,G,B). Frames are in bmp files.
First of all maybe i will write how its work. PSNR formula and description is here: http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio .
Im loading paths to files (source frames and after compression) into 2 arrays. Then im loading frames by IMAQ ReadFile and making them into RGB arrays-> type I16. Let me explain why I16, cause when i was working on default U8 during subtraction process when the second pixel value was higher than the first one i got numbers from 255 till down. Example: Source pixel value is 25, after compression pixel value is 28 and i receive 255-3 so 252. When i have i16 it will be -3. As formula is i have to make square of this new value, difference between this values is important, because -3^2 its not equal to 252^2 and  PSNR output is different(not correct when its U8). So here is my first question maybe there is other way to do it, cause im loosing time during conversion process. Ok, next im counting PSNR for all three planes separately: R,G,B. Finally im putting PSNR values into arrays. And here comes my sec question, can U have a look at my code and give me some ideas how to make it working faster?

Here is my performance sheet, made for 148 frames:
http://img837.imageshack.us/img837/9964/razzz.jpg

And i attached files from project. I added 2 folders oryg and 15. Oryg is folder with three source files and 15 are 3 files after compression. U have to change your path to this files and change from bmp to jpg.

Im adding images too:
Main program:
http://img834.imageshack.us/img834/8787/maind.jpg
Conversion:
http://img834.imageshack.us/img834/9457/conversion.jpg
PSNR:
http://img836.imageshack.us/img836/4407/psnr.jpg

 

Thx for all help.

Best Regards Paul

 

BTW sorry for my English.

0 Kudos
Message 1 of 6
(4,577 Views)

I can't see attached images, but can recommend to stay away from LabVIEW arrays. Do not perform image to array conversion. If you will put PSNR code in into your own DLL and pass image as pointer to it, then your code will be much faster.

 

Andrey.

 

0 Kudos
Message 2 of 6
(4,564 Views)

Hey,

thx for quick reply. U cant see images in PSNR.zip or this url which i wrote in post? Hmm i have to think about this method, but i dont know too much about dll. Have You got any links or files about how to pass image as pointer, or passing anything to dll?

And in future i want to make not only PSNR estimator, i want to do something like that:

im selecting original source and after compression, than im selecting the method to estimate, like MSE, PSNR, SSIM or smthng else and doing the calcualtions. The reults i want to save in database. Any ideas the best way to to do it?

0 Kudos
Message 3 of 6
(4,559 Views)
0 Kudos
Message 4 of 6
(4,532 Views)

Hey i was fighting today with this dll. I think i have to give up and stay in this code. I made smethng like this:

Its calcluating wrong and slower than G code. I will try with OpenCv and than to dll. Maybe will go better.

http://img844.imageshack.us/i/code.jpg/

 

Maybe anybody know whats wrong, or how to make it better. Cheers!

0 Kudos
Message 5 of 6
(4,502 Views)

@oczekp wrote:

Hey i was fighting today with this dll. I think i have to give up and stay in this code. I made smethng like this:

Its calcluating wrong and slower than G code. I will try with OpenCv and than to dll. Maybe will go better.

http://img844.imageshack.us/i/code.jpg/

 

Maybe anybody know whats wrong, or how to make it better. Cheers!


Your problem is imaqGetPixel. Do not use these functions for obtaining pixel values. Instead of imaqGetPixel use direct access to pixels by pointers!

 

Andrey.

 

0 Kudos
Message 6 of 6
(4,493 Views)