why need to convert from 8U to 32F when manipulate pixel?

asked 2017-08-01 03:26:20 -0600

jjabaram gravatar image

updated 2017-08-01 03:27:34 -0600

I want to access and manipulate each image pixel but first, i need to understand the basic.

I try to understand the basic so I start looking from what is the difference between 8 bit, 16bit, 32 bit :

CV_8U - 8-bit unsigned integers (0..255)
CV_8S - 8-bit signed integers (-128..127) 
CV_16U - 16-bit unsigned integers (0..65535)
CV_16S - 16-bit signed integers (-32768..32767) 
CV_32S - 32-bit signed integers (-2147483648..2147483647) 
CV_32F - 32-bit floating-point numbers (-FLT_MAX..FLT_MAX, INF, NAN) //other sources say is (0.0 to 1.0)

when I try to manipulate image I need to convert to 32F that what I read from forum and articles.

My question is :

  1. what is the difference between 8, 16, 32 bit just range of number? what is a channel? what is scalar? what is vec3b?
  2. what is CV_32F ? is it range from 0.0 to 1.0 or more than that?(I try to show an image that I already convert to 32F and the image is just white (my understanding is the value that greater than 1 is white).)
  3. why we need to convert 8U to 32F when calculating pixel?
  4. what happens if manipulate image without convert to 32F?
  5. what is actually happen when converting 8U image to 32F and the other way around ? (from what I read when 32F convert to 8U is multiplied by 255. please explain more about the details )
  6. when calculating and get float and minus value as result, and convert to 8U what happened to float and minus value because 8U is unsigned integer from 0 to 255?

can someone please explain to me with your own way because I try to read the manual is hard to understand. Thank you very much for your help.

edit retag flag offensive close merge delete

Comments

Forum is about opencv. You can find many ressources about yours questions on web example

LBerger gravatar imageLBerger ( 2017-08-01 04:46:30 -0600 )edit