POV-Ray : Newsgroups : povray.advanced-users : Comparing colors specified by byte-value using POV-Ray rgb : Re: Comparing colors specified by byte-value using POV-Ray rgb Server Time
27 Sep 2024 18:48:46 EDT (-0400)
  Re: Comparing colors specified by byte-value using POV-Ray rgb  
From: kurtz le pirate
Date: 1 May 2024 03:52:18
Message: <6631f4b2$1@news.povray.org>
On 28/04/2024 15:15, Bald Eagle wrote:

> I have an image that I generate by color-filling M$ Excel cells, and
> copy-pasting that into IrfanView, and saving to .png
> 
> I then want to look at certain colors to determine if it's a walkable path, or
> an obstacle.
> 
> This works well when I specify colors with all 255's or all 0's, but when I have
> intermediate shades, I'm trying to use the <0-255, 0-255, 0-255>/255 value as a
> comparison, but the algorithm is just recognizing it all as unwalkable.
> 
> I'll probably have to go back on run some tests to see what eval_pigment returns
> as an rgb triplet.
> I'm wondering if I'm going to have to have to use srgb.
> I also was thinking about specifying a narrow _range_ of values to give me a
> +/-1 wiggle room in byte values when converted to 0-1, so that'll probably
> involve math.inc and a special use of VEq and a threshold.
> 
> Has anyone ever come across a situation like this?

Not sure i understand your problem, but yes, eval_pigment does return a
color triplet <red, green, blue> in [0..1] range.

An idea for your comparisons: turn your color into HSV.
- Compare the wanted color with the H value plus/minus intervale (degrees).
- Reject colors that are below a threshold of S and V.



IMHO about srgb (and the current discussion in p.b.tutorials) :
This model is useful for calculating the final pixel color value as a
function of object pigment, light and gamma. But not the other way around...




-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.