Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
rows, cols = img1.shape[:2]
x = np.random.randint(0, 255, (w1, h1))
for i in range(rows):
for j in range(cols):
k = x[i, j]
I am finding difficulty in completing the code for finding the pixel by pixel difference of two images in Python OpenCV. Could you please help me with the right code.
In any case you should avoid loops over single pixels, but use operations which work on full images
You may want to have a look at the general OpenCV Python tutorial.
There is a chapter on arithmetic operation on images, this is what you are looking for:
http://docs.opencv.org/3.1.0/d0/d86/tutorial_py_image_arithmetics.html#gsc.tab=0
The pdf version of the complete tutorial can be found here:
https://media.readthedocs.org/pdf/opencv-python-tutroals/latest/opencv-python-tutroals.pdf
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 days ago.
Improve this question
I want to calculate the normal vectors to the chessboard as shown in blue in Python.
chessboard
Ideally each vector should be about 2x the width of the square it is in.
So far I've labelled the four corners of my chessboard, and used cv2.findHomography to get the homography matrix which translates the normal image into a flat image.
normal flat
I was hoping that I could multiply the normal vector in flat space, (0, 0, 1), through the inverse homography matrix to get the normal vectors in the original space, but this hasn't worked at all.
The paper I am following suggests this
part1
part2
but I cannot see how to get these values from the 4 corners of the chessboard. Is there something in cv2 that can help?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am having a short sequence of grayscale images ( 20 images ), which is consecutive frames collected from a camera. I need to identify the location of a small moving object in each image. I have tried to use background subtraction, and can identify the moving pixels in each image. How can I proceed to detect the exact location of that moving object ?
You can try this way.
(1) find the object using template matching at first time.
https://docs.opencv.org/3.0-beta/doc/tutorials/imgproc/histograms/template_matching/template_matching.html?highlight=template%20matching
(2) Tracking the object using camshift or other tracking algorithm.
https://github.com/opencv/opencv/blob/master/samples/python/camshift.py
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I would like to code a program that will use a phones camera to read a node graph and then perform dijkstra's algorithm on it, displaying the shortest path.
Could pytesseract or other OCR tools for python read node graphs (such as in the image. Real use would be on printed ones) and give me enough information to get node coordinates and what letters are next to them, as well as the positions of the edges/which nodes they connect and what numbers are next to them?
Any help would be much appreciated.
https://i.stack.imgur.com/RUZwA.jpg
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have an image that I'm masking, but even the text gets thresholded. Here's a thresdholded image below:
As you can see, the time, letters and such are also a part of the mask. I want to get rid of them. How do I go about it?
If the images follow that kind of pattern, you could try to apply a morphological closing.
Whith a mask the right size for the closing and opening, it will get rid of the text in the image, leaving it black.
Note that applying a closing may also slightly modify the rest of the image (for instance, a circular mask may smooth the edges of the circle in the center of the mask).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
In Python, how can I rotate an array with 20,40,60,..200 degree? Actually, this array contains fits image and I want to rotate this fits image. I know that I can rotate image, but this image is in form of array.
Thanks in advance!
Cheers,
-Viral
Did you try this?
scipy.ndimage.interpolation.rotate()