pixels

GUI to view values in image using OpenCV in ubuntu12.04

拈花ヽ惹草 提交于 2019-12-23 05:17:49
问题 Is it possible to simultaneously display an image and the pixel,coordinate values based on the mouse pointer positions? I am asking an OpenCV equivalent of imview function in MATLAB. 回答1: You don't need Qt to do that. Just use default OpenCV function imshow to show image and SetMouseCallback to set callback on mouse click. 回答2: It can be done using mouse call back events. You can find a good example in \opencv\samples\cpp\grabcut.cpp 回答3: I had a few problems trying to do this with OpenCV

I Need a fast way to loop through pixels of an Image/Stack in Python

孤街醉人 提交于 2019-12-22 18:27:51
问题 I have created a 3D median filter which does work and is the following: def Median_Filter_3D(image,kernel): window = np.zeros(shape=(kernel,kernel,kernel), dtype = np.uint8) n = (kernel-1)/2 #Deals with Image border imgout = np.empty_like(image) w,h,l = image.shape() %%Start Loop over each pixel for y in np.arange(0,(w-n*2),1): for x in np.arange(0,(h-n*2),1): for z in np.arange(0,(l-n*2),1): window[:,:,:] = image[x:x+kernel,y:y+kernel,z:z+kernel] med = np.median(window) imgout[x+n,y+n,z+n] =

Generating pixel values of line connecting 2 points

风流意气都作罢 提交于 2019-12-21 22:28:10
问题 I am having some troubles trying to connect separate points in my picture (see below). Right now, the code I have is as follows: first_time = resulting_coords[0:40] for i in range(len(first_time)): if(i < (len(first_time))-1): cv2.line(copy_test_image[0], (resulting_coords[i,0],resulting_coords[i,1]), (resulting_coords[i+1,0],resulting_coords[i+1,1]), (0,0,225), 2) elif(i>=(len(first_time))-1): # print(i) cv2.line(copy_test_image[0], (resulting_coords[i,0],resulting_coords[i,1]), (resulting

Drawing Images on Html5 Canvas at floating point coordinates

喜夏-厌秋 提交于 2019-12-21 20:47:43
问题 As you know using rounded coordinates while drawing on canvas is faster. Also floating coordinates may cause unintended gaps on canvas. For example, you are drawing google map tiles to canvas, 256x256 tiles work well, if the starting coordinates are integer. If not, to avoid one pixel unpainted lines, you should round the coordinates. Here, that's Ok. But, what if you should use scaling, transformation over canvas, how can you round the coordinates? e.g. ctx.drawImage(image, round(x), round(y

IllegalArgumentException in Bitmap.getPixels()

柔情痞子 提交于 2019-12-21 17:46:11
问题 I'd like to copy the data from a Bitmap into an int[] using getPixels() , this is my current code: int[] pixels = new int[myBitmap.getHeight() * myBitmap.getWidth()]; myBitmap.getPixels(pixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getHeight(), myBitmap.getWidth()); for(int i = 0; i < myBitmap.getHeight() * myBitmap.getWidth(); i++) { Log.e(TAG, "pixel"+i+"" +pixels[i]); } But it's throwing an exception: 05-04 20:24:08.281: ERROR/AndroidRuntime(5700): Uncaught handler: thread main exiting

algorithm for finding out pixel coordinates on a circumference of a circle

﹥>﹥吖頭↗ 提交于 2019-12-21 09:39:09
问题 how do i find out pixel value at certain degree on the circumference of a circle if I know the pixel co-ordinates of the center of the circle, radius of the circle ,and perpendicular angle. Basically, I am trying to draw the hands of a clock at various times ( 1 o clock , 2 o clock etc ) 回答1: Let h be the hour as a floating point number ( h=2.25 would be 02:15, etc.) between 0 and 12. (cX,cY) are the coordinates of the center. hLength and mLength are the lengths of the hour and min hands. //

How to get the size (in pixels) of a font in WinRT app?

微笑、不失礼 提交于 2019-12-20 06:25:32
问题 As titled, in .NET 4.5 we have a font class which can give you the Height in pixes, but how about in WinRT? Is there any API that I can use to get the pixels it uses? 回答1: Since not even the FormattedText class exists in the .NET API for Windows Store Apps my workaround is to use a TextBlock: TextBlock dummyTextBlock = new TextBlock(); dummyTextBlock.FontFamily = new FontFamily("Tahoma"); dummyTextBlock.FontSize = 18; dummyTextBlock.FontStyle = FontStyle.Normal; dummyTextBlock.FontWeight =

Calculate bounding box of arbitrary pixel-based drawing

蹲街弑〆低调 提交于 2019-12-20 01:09:05
问题 Given a contiguous drawing of arbitrary pixels (e.g. on an HTML5 Canvas) is there any algorithm for finding the axis-aligned bounding box that is more efficient than simply looking at every pixel and recording the min/max x/y values? 回答1: Just scanline from top left to right and down to get y top,and similar algorithm with different directions for the rest. Edit by Phrogz: Here's a pseudo-code implementation. An included optimization ensures that each scan line does not look at pixels covered

how many pixels is a meter in Box2D?

假如想象 提交于 2019-12-19 10:10:45
问题 Question is simple so, no codes! If someone knows Box2D and SDL2, then, please tell me how to wrap SDL_Rect with b2body. Ofcourse, it requires to know the conversion of metre to pixel and vice versa. This is because Box2D measures distance in metres. Can you give me a simple expression or function to convert metres(of Box2D) to pixels or pixels to metres(of Box2D)? 回答1: Can you give me a simple expression or function to convert metres(of Box2D) to pixels or pixels to metres(of Box2D)?

What does half a pixel mean in the font-size CSS property?

狂风中的少年 提交于 2019-12-19 05:46:44
问题 I'm currently working on a website redesign and I'm receiving a list with the required changes from an agency. The header menu of the site currently has the following styles: line-height: 1em; font-size: 11px; In one of the documents I have received there's a change request that requires me to change those styles to: line-height: 1.2em; font-size: 11.5px; I know that the EMs are OK with the decimal values but what does half a pixel mean in the font size? I have tried to change the font size