简体   繁体   中英

How can I check HSV value of pixel?

I want to read HSV value of pixel. I wrote that code, but it is probably wrong. Can you help me with that? Thanks a lot and have a nice day!

img = new QImage(600,600,QImage::Format_RGB32);
img -> load("D:/1.jpg");
bits = img->bits();

int h = bits[0].hue();
int s = bits[1].saturation();
int v = bits[2].value();

transform to QColor and use .toHsv

QColor color(bits[0],bits[1],bits[2]);
color.toHsv();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM