raster-graphics

How to interpret the pixel array in a 1 bpp BMP file

旧街凉风 提交于 2020-01-02 09:35:05
问题 I can't find a way to explain the pixel array in the following situation: I created a BMP image 2x2 pixels with MS Paint on Windows 7. Saved it as monochrome BMP (which I think means BMP with color depth 1 bit per pixel) This is how the image looks like when zoomed it (black pixel, white pixel, white pixel, black pixel) Then I open the bmp with a hex editor and I can see the following info: 00: 424d 4600 0000 0000 0000 3e00 0000 2800 BMF.......>...(. 10: 0000 0200 0000 0200 0000 0100 0100

ploting artefact with points over raster

孤人 提交于 2019-12-19 07:23:06
问题 I noticed some weird behavior when resizing the plot window. Consider library(sp) library(rgeos) library(raster) rst.test <- raster(nrows=300, ncols=300, xmn=-150, xmx=150, ymn=-150, ymx=150, crs="NA") sap.krog300 <- SpatialPoints(coordinates(matrix(c(0,0), ncol = 2))) sap.krog300 <- gBuffer(spgeom = sap.krog300, width = 100, quadsegs = 20) shrunk <- gBuffer(spgeom = sap.krog300, width = -30) shrunk <- rasterize(x = shrunk, y = rst.test) shrunk.coords <- xyFromCell(object = rst.test, cell =

How to interpret the pixel array in a 1 bpp BMP file

北城以北 提交于 2019-12-06 03:43:27
I can't find a way to explain the pixel array in the following situation: I created a BMP image 2x2 pixels with MS Paint on Windows 7. Saved it as monochrome BMP (which I think means BMP with color depth 1 bit per pixel) This is how the image looks like when zoomed it (black pixel, white pixel, white pixel, black pixel) Then I open the bmp with a hex editor and I can see the following info: 00: 424d 4600 0000 0000 0000 3e00 0000 2800 BMF.......>...(. 10: 0000 0200 0000 0200 0000 0100 0100 0000 ................ 20: 0000 0800 0000 0000 0000 0000 0000 0000 ................ 30: 0000 0000 0000 0000

What algorithm is behind the Gimp's “Color to Alpha” feature?

纵饮孤独 提交于 2019-12-03 14:12:54
问题 For those who aren't familiar with the Gimp's "Color to Alpha" feature yet, here is the page on it from the Gimp's documentation: Color to Alpha. It does a really good job, and I wonder much how exactly Gimp does it in terms of color manipulation, whichever color space the colors might be in. Thanks a bunch for any hints. EDIT 1: Generating transparency information for a pixel based on its similarity to the key color (the one you select in the "Color to Alpha" dialog), like some folk

What algorithm is behind the Gimp's “Color to Alpha” feature?

南楼画角 提交于 2019-12-03 04:13:31
For those who aren't familiar with the Gimp's "Color to Alpha" feature yet, here is the page on it from the Gimp's documentation: Color to Alpha . It does a really good job, and I wonder much how exactly Gimp does it in terms of color manipulation, whichever color space the colors might be in. Thanks a bunch for any hints. EDIT 1: Generating transparency information for a pixel based on its similarity to the key color (the one you select in the "Color to Alpha" dialog), like some folk suggested before removing his answer for some reason, would sound like a good insight, but I suppose it's more

ploting artefact with points over raster

那年仲夏 提交于 2019-12-01 04:27:42
I noticed some weird behavior when resizing the plot window. Consider library(sp) library(rgeos) library(raster) rst.test <- raster(nrows=300, ncols=300, xmn=-150, xmx=150, ymn=-150, ymx=150, crs="NA") sap.krog300 <- SpatialPoints(coordinates(matrix(c(0,0), ncol = 2))) sap.krog300 <- gBuffer(spgeom = sap.krog300, width = 100, quadsegs = 20) shrunk <- gBuffer(spgeom = sap.krog300, width = -30) shrunk <- rasterize(x = shrunk, y = rst.test) shrunk.coords <- xyFromCell(object = rst.test, cell = which(shrunk[] == 1)) plot(shrunk) points(shrunk.coords, pch = "+") If you resize the window, plotted