OpenCV/Method to control of pixel value drawing in Qt Window †
#multilang(ja){{
概要
OpenCV 2.3.1(Qt有効版)で画像を表示した場合,デフォルトでは一定倍率以上拡大すると
常に画素値が表示されます.本パッチはこの画素値表示機能の動的な切り替えを可能とします.

ダウンロード
Version | Filename | Size | Date | Type | Download |
1.0 | opencv_qt_window_extension_v1.zip | 37.3 KB | 20111008 | zip |  |
変更履歴 †
Version | Date | 変更内容 |
1.0 | 20111008 | 新規作成 |
使い方 †
- 上記リンクからopencv_qt_window_extension_v1.zipをダウンロードして展開します.
- 展開したhighguiディレクトリを下記ディレクトリに上書きして下さい.
OpenCV-2.3.1\modules\highgui
- CMakeでWITH_QTを有効にしてビルドしてください.
追加されるウィンドウプロパティと値 †
cv::setWindowProperty?関数, cv::getWindowProperty?関数で用いることができる
ウィンドウプロパティ,値として下記のものが追加されます.
ウィンドウプロパティ †
prop_id | CV_WND_PROP_DRAW_PIXEL_VAL |
prop_value | CV_WINDOW_ENABLE_DRAW_PIXEL_VAL |
| CV_WINDOW_DISABLE_DRAW_PIXEL_VAL |
サンプルプログラム †
| #include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#ifdef _DEBUG
#pragma comment( lib, "opencv_core231d.lib" )
#pragma comment( lib, "opencv_imgproc231d.lib" )
#pragma comment( lib, "opencv_highgui231d.lib" )
#else
#pragma comment( lib, "opencv_core231.lib" )
#pragma comment( lib, "opencv_imgproc231.lib" )
#pragma comment( lib, "opencv_highgui231.lib" )
#endif
using namespace std;
int main(int argc, char *argv[])
{
if(argc < 2)
{
cout << "[usage]" << argv[0] << " filename" << endl;
return -1;
}
cv::Mat src_img = cv::imread(argv[1], CV_LOAD_IMAGE_UNCHANGED);
cv::namedWindow("src", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO | CV_GUI_EXPANDED);
cv::setWindowProperty("src", CV_WND_PROP_DRAW_PIXEL_VAL, CV_WINDOW_ENABLE_DRAW_PIXEL_VAL);
cv::imshow("src", src_img);
cv::waitKey(0);
cv::destroyAllWindows();
return 0;
}
|
Contact †
間違い・御指摘等ありましたら,
までメールにてご連絡ください.
}}
#multilang(en){{
Abstract
On the OpenCV 2.3.1(WITH_QT), if you zoom in than certain value, the pixel value is always displayed.
This page describes the method to switch enable/disable drawing pixel value on OpenCV 2.3.1.

Download
Version | Filename | Size | Date | Type | Download |
1.0 | opencv_qt_window_extension_v1.zip | 37.3 KB | 20111008 | zip |  |
ChangeLog?
Version | Date | Changes |
1.0 | 20111008 | First Release |
Usage
- Please download opencv_qt_window_extension_v1.zip. And, extract this file.
- Please overwrite extracted highgui directory to the following directory
OpenCV-2.3.1\modules\highgui
- Please enable "WITH_QT" on CMake, and build OpenCV.
Added window property and values
If you apply this patch, you can use the following window property and values
as arguments of cv::setWindowProperty? and cv::getWindowProperty?.
Window property
prop_id | CV_WND_PROP_DRAW_PIXEL_VAL |
Values
prop_value | CV_WINDOW_ENABLE_DRAW_PIXEL_VAL |
| CV_WINDOW_DISABLE_DRAW_PIXEL_VAL |
Sample program
| #include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#ifdef _DEBUG
#pragma comment( lib, "opencv_core231d.lib" )
#pragma comment( lib, "opencv_imgproc231d.lib" )
#pragma comment( lib, "opencv_highgui231d.lib" )
#else
#pragma comment( lib, "opencv_core231.lib" )
#pragma comment( lib, "opencv_imgproc231.lib" )
#pragma comment( lib, "opencv_highgui231.lib" )
#endif
using namespace std;
int main(int argc, char *argv[])
{
if(argc < 2)
{
cout << "[usage]" << argv[0] << " filename" << endl;
return -1;
}
cv::Mat src_img = cv::imread(argv[1], CV_LOAD_IMAGE_UNCHANGED);
cv::namedWindow("src", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO | CV_GUI_EXPANDED);
cv::setWindowProperty("src", CV_WND_PROP_DRAW_PIXEL_VAL, CV_WINDOW_ENABLE_DRAW_PIXEL_VAL);
cv::imshow("src", src_img);
cv::waitKey(0);
cv::destroyAllWindows();
return 0;
}
|
Contact
If you have question,please send e-mail to the following address.
}}