S
S
SergeySerge112022-03-16 01:12:05
Algorithms
SergeySerge11, 2022-03-16 01:12:05

What pattern, how to organize the project structure for different RGB and YUV pixel formats?

There are 2 classes
YUV double Y,U,V
RGB byte R,G,B

How can I make a common interface or something else for these 2 structures? What pattern? After all, there are fields with the names rgb and byte fields, and there are double y, u, v
So what would you like to transfer an object that will produce a pixel according to the format?
And yet, if anyone knows in what format it is best to prepare for image segmentation / binarization?
For example, by the number Y in YUV, or (R + G + B) / 3, or is there something else better?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
hint000, 2022-03-16
@hint000

or (R+G+B)/3 or is there something better?
There is better, because G is much brighter for the eye than B:
0.2126*R + 0.7152*G + 0.0722*B
https://stackoverflow.com/questions/596216/formula...
https://en.wikipedia.org /wiki/Relative_luminance

W
Wataru, 2022-03-16
@wataru

I would advise doing abstraction not at the pixel level, but at the image level. Because this way you can better organize the location of pixels in memory and process the image faster. Instead of a function that checks for each pixel what R or Y should be taken from it, they use functions that pass plane - one channel. What exactly is R, G, Y, V is usually not important. Whether you are looking for a contour or smoothing an image, then the work is exactly the same in each channel.
As an example, you can look here or here .

A
Alexander Skusnov, 2022-03-16
@AlexSku

Examples of segmentation in four formats on Matlab.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question