pixels

Selecting the 4-neighbours of a pixel [closed]

一世执手 提交于 2019-12-02 23:56:47
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . How can I select the 4-neighbours of a pixel in matlab ? Thanks. 回答1: If the the image is img and the current pixel indices are i and j , then the four neighbors will be: img(i-1,j); img(i+1,j); img(i,j-1); img(i

Transform array to png in php [closed]

拟墨画扇 提交于 2019-12-02 13:06:19
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I was wondering how i could transform an array of colors to a png image file. the array is called $pixels . Please help me. $im = imagecreatefrompng('start.png'); $background = imagecreatefrompng('background.png'

Silverlight device independent coordinates

醉酒当歌 提交于 2019-12-02 07:37:37
问题 I've written a Silverlight application that does not scale when I change from 96 dpi to 120 dpi The text and graphics does not change physical size on the screen as measured by a ruler. I've read in various places that Silverlight should adjust to changes in DPI configuration. The non-Silverlight portion of the web page scales as expected. It seems as if the Silverlight plugin is using Pixels as the unit of measure rather than 1/96 inch. What's the explanation? I'm running Windows XP and

divide the image into 3*3 blocks

我只是一个虾纸丫 提交于 2019-12-02 04:19:01
问题 I have a matrix that does not happen to have dimensions that are multiples of 3 or it might. How can we divide the entire image into blocks of 3*3 matrices. (Can ignore the last ones which does not come under the 3*3 multiples. Also, the 3*3 matrices can be be saved in arrays. a=3; b=3; %window size x=size(f,1)/a; y=size(f,2)/b; %f is the original image m=a*ones(1,x); n=b*ones(1,y); I=mat2cell(f,m,n); 回答1: I have never used mat2cell to divide matrices, and thinking about it now it seems like

Python connected components with pixel list

别说谁变了你拦得住时间么 提交于 2019-12-02 04:01:56
问题 In matlab you can use cc = bwconncomp(bimg); pixels = cc.PixelIdxList{i} To get pixel list of each connected components. What's the python equivalent? I tried from skimage import measure label = measure.label(bimg) To get the labels, however, this does not come with pixel list. Any suggestions? 回答1: The regionprops function in scikit-image returns the property "coords", an (N, 2) ndarray coordinate list (row, col) of the region. I ran into the same problem and am using this to get the pixel

Delphi TBitmap - why are Pixels and ScanLine different?

浪尽此生 提交于 2019-12-01 22:10:01
问题 While using a 32 bit TBitmap, I switched from Canvas.Pixels to ScanLine. I then set the value to Red, only to find it was displayed as blue. Any idea why? Here's a code excerpt: procedure TForm1.FormPaint(Sender: TObject); var varBitmap: TBitmap; pLock: PIntegerArray; iColor: integer; begin varBitmap := TBitmap.Create; varBitmap.PixelFormat := pf32bit; varBitmap.Width := 800; varBitmap.Height := 600; // Set Pixels to Red varBitmap.Canvas.Pixels[0, 0] := $0000FF; // Shows $FF0000 (blue) pLock

Delphi TBitmap - why are Pixels and ScanLine different?

≡放荡痞女 提交于 2019-12-01 19:40:01
While using a 32 bit TBitmap, I switched from Canvas.Pixels to ScanLine. I then set the value to Red, only to find it was displayed as blue. Any idea why? Here's a code excerpt: procedure TForm1.FormPaint(Sender: TObject); var varBitmap: TBitmap; pLock: PIntegerArray; iColor: integer; begin varBitmap := TBitmap.Create; varBitmap.PixelFormat := pf32bit; varBitmap.Width := 800; varBitmap.Height := 600; // Set Pixels to Red varBitmap.Canvas.Pixels[0, 0] := $0000FF; // Shows $FF0000 (blue) pLock := varBitmap.ScanLine[0]; iColor := pLock[0]; ShowMessageFmt('%x', [iColor]); // Set ScanLine to Red

Calculate bounding box of arbitrary pixel-based drawing

心已入冬 提交于 2019-12-01 18:55:43
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 ? adrix89 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 by an earlier pass: function boundingBox() w = getWidth() # Assuming graphics address goes from [0

How to get pixel color at location from UIimage scaled within a UIimageView

风格不统一 提交于 2019-12-01 11:12:10
问题 I'm currently using this technique to get the color of a pixel in a UIimage. (on Ios) - (UIColor*) getPixelColorAtLocation:(CGPoint)point { UIColor* color = nil; CGImageRef inImage = self.image.CGImage; // Create off screen bitmap context to draw the image into. Format ARGB is 4 bytes for each pixel: Alpa, Red, Green, Blue CGContextRef cgctx = [self createARGBBitmapContextFromImage:inImage]; if (cgctx == NULL) { return nil; /* error */ } size_t w = CGImageGetWidth(inImage); size_t h =