I am trying to draw 16 images side by side on a blank unnamed window.
blank window size is 2456 x 1296 pixels. Each image size is 614x324 pixels.
I want to know how to draw or display images together on one window.
Here is my desired output:
enter image description here
I think you can simply concatenate 16 images into a big image by cv2.hconcat and cv2.vconcat functions like below.
new_img = cv2.hconcat([im1, im2])
new_img = cv2.vconcat([im1, im2])
Related
So I am trying to make a single top down view from these 4 bird eye view images taken from 4 different cameras and after doing perspective transform, I just need to stack the 4 trapezoids together (without the green parts which are the walls).
the four images
example of what I want to achieve
first make your 4 images the same size by padding them with 0s while maintaining their position.
lets assume the top & bottom images are 150x50 and the left & right images are 50x100. So your final output image size will be 150x50+100+50=150x200. now do the math to figure out where to pad each image to keep their position.
now we need to remove the walls in each image and only keep the floor, you have two options from here:
Option 1:
Create a new black "mask" image for each image (same size 150x200). Now you can either manually get the location of the floor pixels or use color, and set the floor pixels in the mask to 255.
Now that you have the floor pixels mask for each image, you will need to copy those floor pixels over to your final output image. so create a new black image, for each mask, get the location of the non-zero pixels and copy the value of the pixels from the corresponding image over to your output image
Option 2:
Find the wall pixels in your images and set them to 0 then just add the images together.
I am attempting to separate red, green and blue components of an image and display the resulting images in separate subplots.
To do this, for each colour, I have created an array of zeros the same shape as the original image (using the function np.zeros), and copied one of the image colours across using slicing.
However, the output just appears to be a red square, therefore I don't think the code is working how I would expect it to. Does anyone have any idea where I'm going wrong?
red_image[:,:,0] = red_channel
image = plt.imread('archway.jpg')
plt.imshow(image)
red_channel = image[:,:,0]
red_image = np.zeros(image.shape)
red_image[:,:,0] = red_channel
plt.imshow(red_image)
I'm wanting to add pre-generated heatmaps over photographs. The colours in the images aren't important and to make the heatmap colours stand out I'm making the images greyscale. I've done this using
grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
However the greyscale image now has one fewer dimensions compared to the heatmap (which is BRG). How can I overlay the heatmap on top of the grey image?
With the two identical size and mode images in place, execute the following code.
from PIL import Images
im_1 = Image.open("/constr/pics1/100_canary.png")
# mode is RGBA
im_2 = Image.open("/constr/pics1/100_cockcrow.png")
# Check on mode, size and format first for compatibility.
# Make both modes the same
im_4 = Image.blend(im_1, im_2, 0.5)
im_4.show()
I have an Image of 128x128 pixels in which, there are 1024 blocks of 4x4 pixels each.
If the coordinates of the first block areblock1= im[0:4, 0:4], then I want to replace the colour of pixels into a specific pixel intensity(or colour),example-128.
So what I want to do is I want to change the colour of the image something like this-
block1=im[0:4,0:4]
block1.replace_colour=128
Note that the image is in the grayscale.Thanks in advance.
You can do that like this:
colorValue = 150
im[0:4,0:4] = colorValue
How can i make a gtk.Image that is made from an list of gtk.gdk.Color.
color_list = [gtk.gdk.Color(100*i,100*i,100*i) for i in range(10)]
image = gtk.Image()
draw_image_from_list(color_list, image)
I need that procedure and the image would be just one column of pixels:
|color1|
|color2|
|color3|
...
Here's a widget that almost does what you want: https://github.com/ptomato/LaserCam/blob/master/src/ColorMapIndicator.py
It's a gtk.DrawingArea instead of a gtk.Image, but I decided against using an image since they are more meant for displaying image files, not for drawing on. It displays the colors in a horizontal bar 128 pixels wide and 10 high, but that should be easy enough to change. And finally, it does it from an array of numbers, not of gtk.gdk.Color, but it looks like you generate those from numbers anyway in your example.