MFC dialog and form - c++

I have a dialog (there are 3 edit controls in order to display 3 color channels RGB), I use openCV to open an image in a new form. What I want is when I move the mouse to any point on the image, each of the RGB color values will be shown in 3 edit boxed (on the dialog). How can I do that?
Thanks!!!

Perhaps this will help:
OpenCV rgb value for cv::Point in cv::Mat
To get the current cursor position you can use GetCursorPos and eventually ScreenToClient functions.

Related

Paint application Qt

I am trying to create a simple paint application using Qt Creator. I want to have a rectangular area on QDialog in which I can draw an image using mouse. The image format will be QImage::Format_Mono (Black and white, pixel indexes are either 0 or 1). I will use pixel indexes for simple image processing purpose, which operates on simple 1 and 0 pixel values, so Format_Mono is essential.
Now the application does its job, but the image (painting area) is stuck at left top part (positioned at x=0 and y=0). I want to have rectangular image editor part at any x and y coordinates I want.
To create the image editor I defined a QImage in dialog.h
QImage image;
In constructor of the Dialog I have:
image = QImage(ui->label->size(), QImage::Format_Mono);
image.fill(Qt::black);
As you can see in above code, I have a QLabel named label in my user interface. I want to put the image editor part in that label (or do something similar).
I checked the QImage documentation, but could not find a function to change the position of the image. Or, it would also be good if I could find any other way to put the image (image editor) in QLabel.
What can I do to have that feature in my application?
EDIT: The created image editor part has the same size as the label (as it should be the case), but image editor (QImage) starts at x=0 and y=0 only.

Image overlap with alphachannel doesn't work on QT

I've put two label of the same dimension overlapped on my GUI. On the first, that is on the back there is one image set by the pixmap of the label. The second label has another image set by pixmap that is trasparent in some pixel. During design i can see the back image via the front image. When I execute the program, the trasparent pixel of the second image are transformed into white pixel, so i cant see the back image. I'm using QT 5.10. The image are in .png format.
I've resolved putting autoFillBackground on and i've changed the color of window in palette putting a transparent color

MITK Segmentation draw Rectangle

I have to segment a few things in a dataset I have (.nrrd-file) by drawing a rectangle around the area of interest and saving the segments (also as .nrrd-files).
I tried everything in the Segmentation-Tool that comes with MITK but I cannot seem to find a way to draw rectangles. I also tried to do some key combos (like holding shift, ctrl or alt) while drawing but in vain.
I know I can use the Measurement-Tool to select rectangles and save them (as .pf-files), but using that I'd have to write a some code to convert those selected rectangles into rectangle segmentations later on.
Does anyone know whether there's a possibility (that I didnt find yet) to draw rectangles in the Segmentation tool, or some other way so there's no need to write a workaround?
You can use the Image Cropper plugin in MITK 2016.11 for rectangular image masking and cropping (scissors icon).
Open the plugin, select your image in the Data Manager and click on the New button in the plugin to create a bounding object. You can modify the rectangular bounding shape in the render windows by dragging its red handles. You can move the whole shape by hovering over the bounding shape (it will turn green), click, and than drag.
Click on the Mask button if you want to get an image with the same dimensions in which all pixels outside the bounding shape are set to a user defined value (see the Advanced settings in the plugin). Click on the Crop button otherwise.
Note that you can always press F1 in any active MITK plugin to open a help page with detailed instructions.

Set transparency of an image on openFrameworks

I'm working on openFrameworks and I want to set the transparency of an image in order to modify it when I press a button, but I don't know how to implement this parameter.
In which way can I change this value? Is there a particular function to manage the transparency of an image?
check out http://openframeworks.cc/ofBook/chapters/intro_to_graphics.html
ofEnableAlphaBlending();
ofSetColor(255,0,0,127); # this would be a 50% transparent red color
ofDrawRectangle(20,20,100,100);
ofDisableAlphaBlending();

win32 c++ owner draw button with transparent image

i've implemented a owner draw button into my win32 app (no MFC). The button is a normal 20x20 bitmap (round icon with transparency). The problem is that the button is positioned on a solid background and i can see the buttons gray background (since the bitmap is round). I've tried responding to WM_CTLCOLORBTN with NULL_BRUSH but no luck.. I've tried displaying the button using a bitmap and a ico file but wont budge.. Does anyone know how to solve this problem?
This is my problem, the settings icon should be transparent at the edges (not white/gray)
It sounds like you're trying to make a non-rectangular control.
You could call SetWindowRgn to tell Windows that your control is non-rectangular.
In addition to what #joel's answer, if you want to make some area transperant put a unique color in the area where you want to have transperancy using some image editors (RGB(0xFF,0x00,0xFF)) is mostly used Then use TransperantBlt
You say it's a solid background but your image shows some kind of orange-yellow gradient as a background. If it really was a standard windows button solid color you can load the bitmap with LoadImage using the LR_LOADMAP3DCOLORS or LR_LOADTRANSPARENT. Since you have a gradient you'll have to use a more complicated technique to mask out the bitmap.
http://www.winprog.org/tutorial/transparency.html