Array
(
    [HTTP_X_FORWARDED_FOR] => 3.85.214.125
    [HTTP_X_FORWARDED_PROTO] => http
    [HTTP_X_FORWARDED_PORT] => 80
    [HTTP_HOST] => forums.codeguru.com
    [HTTP_X_AMZN_TRACE_ID] => Root=1-5f0d379b-c266c77ba9ecd989587a8dc5
    [HTTP_USER_AGENT] => CCBot/2.0 (https://commoncrawl.org/faq/)
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => br,gzip
    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    [SERVER_SIGNATURE] => 
Apache/2.4.29 (Ubuntu) Server at forums.codeguru.com Port 80
[SERVER_SOFTWARE] => Apache/2.4.29 (Ubuntu) [SERVER_NAME] => forums.codeguru.com [SERVER_ADDR] => 10.2.0.8 [SERVER_PORT] => 80 [REMOTE_ADDR] => 10.2.0.153 [DOCUMENT_ROOT] => /var/www/html/forums.codeguru.com/public_html [REQUEST_SCHEME] => http [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => /var/www/html/forums.codeguru.com/public_html [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /var/www/html/forums.codeguru.com/public_html/showthread.php [REMOTE_PORT] => 33370 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => 487656-HSI-in-matrix-to-an-image&s=f37eff4c03bdbfc4f88f3acc566e80f5&p=1892988 [REQUEST_URI] => /showthread.php?487656-HSI-in-matrix-to-an-image&s=f37eff4c03bdbfc4f88f3acc566e80f5&p=1892988 [SCRIPT_NAME] => /showthread.php [PHP_SELF] => /showthread.php [REQUEST_TIME_FLOAT] => 1594701723.449 [REQUEST_TIME] => 1594701723 ) HSI in matrix to an image
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: HSI in matrix to an image

  1. #1
    Join Date
    Nov 2009
    Posts
    7

    HSI in matrix to an image

    Hi, im making a program that can convert RGB to HSI. Hue, Saturation and Intensity.
    Im using OpenCV for doing it. But i however cant used the premade funcs in opencv.

    Im loading my input image into a matrix, and im dragging out the rgb-info for each pixel and converting them to HSI values. And this is gonna run in a loop for x and y to process through the whole image.

    The RGB image is displayed by 3 values per pixel in the range of 0-255. if a value exceeds 255, it will start from 0 again. Meaning if u by some reason get a value of 300 into a pixel's color channel, then it will display as 45 instead.

    The HSI color space works with 3 different brackets, 1 for each channel.
    H is 0-360
    S is 0-1
    I is 255

    "H"and "I" works with whole numbers, but "S" works with 0.3 etc.

    The output i should get from this would be 3 windows with 3 images, displaying the value of H,S,I. But i cant figure out how to get the 0-360 value working.

    So question is more or less if there is some "smart" way of doing it, or if it have to be divided by 255, so that it would be relative colors shown in RGB, but representing their equivalent HSI value.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: HSI in matrix to an image

    For S you need to map 0-1 interval to 0-255. For I, you need to map 0-360 interval to 0-255. Resulting arrays should be used only for graphic representation. If you need to keep computed HSI values, keep them in original format.

  3. #3
    Join Date
    Nov 2009
    Posts
    7

    Re: HSI in matrix to an image

    Yes, but what channels should i use for each of the 3 pictures ?
    Like should i set R-channel = H
    G-channel = S
    B-channel = I
    or how would it be done ?

    http://en.wikipedia.org/wiki/HSI_color_space
    Half way down the page, there is a picture split up in to 3 different pictures.
    This one:


    If u see on the picture, the 1st is normal, 2nd uses more than 1 channel to visualise it, 2nd and 3rd seems like they use fewer.

  4. #4
    Join Date
    Jul 2002
    Posts
    2,543

    Re: HSI in matrix to an image

    I would try the same order: RGB -> HSI. Just remember that Windows bitmap internally keeps colors in BGR order.

  5. #5
    Join Date
    Nov 2009
    Posts
    7

    Re: HSI in matrix to an image

    yep, decided to just go with that. Caus its just a way to visualize some values that arent directly able to be seen visually, as it is with RGB. But ty for the quick replyes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)