[Closed] Reading pixel intensity
I’m wondering if anyone could offer any advice on methodologies with MAXScript that could be used to measure pixel intensities from a loaded bitmap file.
In more detail, I’m working on a project in which I am attempting to use a 2d aerial photograph to extrapolate a 3d model of an area, using pixel intensities to calculate the edges of structures.
Any suggestions as to how such things could be determined using the scripting language would be appreciated.
Mike Longley
Ok so you’ve got a pixel read from a bitmap. I assume by intensity, you’re referring to luminance; darkness and brightness of a specific color. Try this one out:
fn getLum pixelVal = --accepts a point3 value, returns a float of the pixel's luminosity
(
return (0.3*pixelVal.x + 0.59*pixelVal.y + 0.11*pixelVal.z)
)
If you meant saturation:
fn getSat pixelVal = --accepts a point3 value, returns a float of the pixel's saturation
(
return (amax pixelVal.x pixelVal.y pixelVal.z)-(amin pixelVal.x pixelVal.y pixelVal.z)
)
There’s a lot more you can do with bitmaps/pixels in maxscript beyond just reading their info; you can set HSV values, desaturate, blend bitmaps (additive, subtractive, difference, dodge, etc.), even basic global effects like blur and convolution. Let me know if you want more info.
If it’s simple, you’re ok. But at the risk of sounding negative, if you want to do any significant image processing, to detect features, for example, you’d be better off using an application/library outside 3ds. There’s lots of free stuff out there.