Add status bar with color value
This commit is contained in:
@@ -298,3 +298,58 @@ const cv::Mat& RawImage::mat() const
|
||||
{
|
||||
return m_img;
|
||||
}
|
||||
|
||||
bool RawImage::pixel(int x, int y, QVector3D &rgb) const
|
||||
{
|
||||
if(x < 0 || y < 0 || x >= (int)width() || y >= (int)height())return false;
|
||||
|
||||
switch(m_img.type())
|
||||
{
|
||||
case CV_8U:
|
||||
{
|
||||
uint8_t v = m_img.at<uint8_t>(y, x);
|
||||
rgb = QVector3D(v, v, v);
|
||||
break;
|
||||
}
|
||||
case CV_16U:
|
||||
{
|
||||
uint16_t v = m_img.at<uint16_t>(y, x);
|
||||
rgb = QVector3D(v, v, v);
|
||||
break;
|
||||
}
|
||||
case CV_32F:
|
||||
{
|
||||
float v = m_img.at<float>(y, x);
|
||||
rgb = QVector3D(v, v, v);
|
||||
break;
|
||||
}
|
||||
case CV_8UC3:
|
||||
{
|
||||
cv::Vec3b v = m_img.at<cv::Vec3b>(y, x);
|
||||
rgb = QVector3D(v[2], v[1], v[0]);
|
||||
break;
|
||||
}
|
||||
case CV_8UC4:
|
||||
{
|
||||
cv::Vec4b v = m_img.at<cv::Vec4b>(y, x);
|
||||
rgb = QVector3D(v[2], v[1], v[0]);
|
||||
break;
|
||||
}
|
||||
case CV_16UC3:
|
||||
{
|
||||
cv::Vec3w v = m_img.at<cv::Vec3w>(y, x);
|
||||
rgb = QVector3D(v[2], v[1], v[0]);
|
||||
break;
|
||||
}
|
||||
case CV_32FC3:
|
||||
{
|
||||
cv::Vec3f v = m_img.at<cv::Vec3f>(y, x);
|
||||
rgb = QVector3D(v[2], v[1], v[0]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
rgb = QVector3D(0, 0, 0);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user