I have bought BOSON FLIR camera and I tested with Jetson Xavier and it works by streaming with Python & opencv. I have an issue that I am getting grayscale image while I am looking for video with RGB color like Ironbow color. This is the code that I am using with python on nvidia board
import cv2
print(cv2.__version__)
dispW=640
dispH=480
flip=2
cam=cv2.VideoCapture(0)
while True:
ret, frame = cam.read()
cv2.imshow('nanoCam',frame)
if cv2.waitKey(1)==ord('q'):
break
cam.release()
cv2.destroyAllWindows()
kindly looking for your support for conversion.
# im_gray is the "WHITE HOT" picture from FLIR's web site
colorized = cv.applyColorMap(im_gray, cv.COLORMAP_PLASMA)
here's the result:
compare to FLIR's Ironbow:
I think OpenCV's color map is somewhat comparable but it's not as saturated. If you need to match FLIR's color map, there are ways to replicate that even more faithfully.
Read all about colormaps:
https://docs.opencv.org/4.x/d3/d50/group__imgproc__colormap.html
FLIR pictures (white hot + ironbow) pirated from:
https://www.flir.com/discover/ots/outdoor/your-perfect-palette/
Related
I'm trying to display 10-bit grayscale images on an HDR10 monitor.
A Windows app was implemented by DirectXTK: Using HDR rendering (which is based on Direct3D 11). For the purpose of comparison between HDR and SDR, I also duplicated the same app but disabled HDR.
I did a test to display a grayscale gradient image with 26 floors, but found that the middle-high floors in HDR app were "whiter" (or lighter) than that in SDR app:
Grayscale gradient: HDR vs. SDR. This would make my real images become blurred in some case if pixel values in a region range in those floors.
I was expecting the middle floor (12th or 13th floor) should be nearly gray in both HDR and SDR apps, but HDR wasn't in my test. Similar result can be also seen from Microsoft D3D12HDR sample. Is my concept of HDR rendering wrong?
So the closest of what I found is this Mathematica implementation. Yet Mathematica is not opensource nor easily includable in other applications... So I wonder how to do Photoshop like effect OilPaint effect in OpenCV?
Example input data:
Example Result:
Example Difference (note one can not really detect in difference-image any patterns not included in processing result):
And the best thing is it processed image looks close to what experts see in original image:
Images source.
So how to implement a Photoshop like effect OilPaint effect in OpenCV (in Python or C++)?
Here is a classic form of the oil painting effect in Python/OpenCV. Simply apply some morphology open to the image and then brighten the darker regions a little using cv2.normalize.
Input:
import cv2
import numpy as np
# load image
img = cv2.imread("windmill.jpg")
# apply morphology open to smooth the outline
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (6,6))
morph = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
# brighten dark regions
result = cv2.normalize(morph,None,20,255,cv2.NORM_MINMAX)
# write result to disk
cv2.imwrite("windmill_oilpaint.jpg", result)
cv2.imshow("IMAGE", img)
cv2.imshow("OPEN", morph)
cv2.imshow("RESULT", result)
cv2.waitKey(0)
cv2.destroyAllWindows()
I have a problem with normalization.
Let me what the problem is and how I attempt to solve it.
I take a three-channel color image, convert it to grayscale and apply uniform or non-uniform quantization and the same thing.
To this image, I should apply the normalization, but I have a problem even if the image and grayscale and always has three channels.
How can I apply normalization having a three-channel image?
Should the min and the max all be in the three channels?
Could someone give me a hand?
The language I am using is processing 2.
P.S.
Can you do the same thing with a color image instead use a grayscale image?
You can convert between the 1-channel and 3-channel representations easily. I'd recommend scikit-image (http://scikit-image.org/).
from skimage.io import imread
from skimage.color import rgb2gray, gray2rgb
rgb_img = imread('path/to/my/image')
gray_img = rgb2gray(rgb_image)
# Now normalize gray image
gray_norm = gray_img / max(gray_img)
# Now convert back
rgb_norm = gray2rgb(gray_norm)
I worked with a similar problem sometime back. One of the good solutions to this was to:
Convert the image from RGB to HSI
Leaving the Hue and Saturation channels unchanged, simply normalize across the Intensity channel
Convert back to RGB
This logic can be applied accross several other image processing tasks, like for example, applying histogram equalization to RGB images.
I'm processing depth image from Kinect sensor using OpenCV with Emgu wrapper for motion detection using background substraction technic. On frames from Kinect I've noticed places with white spots, which I would like to filter off, make them in color of background. Which OpenCV technic/function should be used for this purpose?
White places are presented on pic:
inpaint will do that,
For this,
Create a mask corresponding to the region to be filled, use Threshold Binary Inverted with high value to create mask.
Now apply inpaint, on source with above mask, adjust inpaintRadius till you get better result.
Also you can use erosion filter after thresold .
I am using SURF features in OpenCV where the input images are converted to GRAY image.
cvtColor(object, object, CV_RGB2GRAY);
When I went through the documentation of OpenSURF I realised that its not in grayscale.
My confusion is that can we apply SURF to any image formats (YUV, HSV, RGB) or we have to change and modify the program to achieve that?
Most feature detectors work on greyscale because they analyse the patterns of edges in the image patch. You can run SURF on any single colour channel from the colour formats you mention i.e. You can run it on Y, U or V from YUV images, or on H, S or V from HSV images. Not sure how OpenSURF treats this, but they must be using the greyscale image internally.
Like OpenCV if you given an image to OpenSURF that is not single channel, it calls cvtColor(src, dst, CV_BGR2GRAY). If you pass either a 3 channel image in a YUV, HSV, Lab etc, things will go horribly wrong because the image will have an inappropriate color conversion applied..