quantifying colors in an image
싶습니다. 진주의 무지개 (진주의 어머니)에 대해 작업하고 있는데,이 껍질에 3 가지 색상 (빨강, 노랑, 초록색)을 정량화하려고합니다 (예 : 위 링크의 오른쪽 그림).색상 추출, 정량 및 분석에서 이미지에서 R
그래서, 테스트를 일부 패키지 (imager
, ImageMagick
, EBImage
을 ...)했다,하지만 난 정말 나를 도와 뭔가를 찾을 수 없습니다.
음, 을 R
에 원으로 표시하고 싶습니다. 픽셀 내의 프리미티브의 면적은 등가 표면적 원의 면적으로 표현 될 수있다. 프리미티브는 유사한 색상의 인접 픽셀의 연속 영역입니다. 원의 중심은 앵커 픽셀이 될 수 있습니다. [- ² - (Ganchor - 승기) ² - (Banchor - BI) ² (리 Ranchor)]
DeltaI = 제곱근 : 그래서, 내가 이렇게해도 괜찮은지 생각 방정식을이
여기서 R, G 및 B는 0에서 255까지의 범위에있는 픽셀의 색상 구성 요소이며 앵커는 앵커 픽셀이고 i는 앵커 픽셀 주변의 동일한 등가 색상 인 모든 픽셀입니다.
이 (Alçiçek & Balaban 2012에서) 예상 결과에 이미지 링크입니다 :
Shrimp resulting equivalent circles
그래서 내 (부팅 근무) 코드가있다,하지만 나는 계속하는 방법을 정말 아무 생각이 없다 .. 수 있음 패키지를 만들려고합니까?
library(png)
nacre <- readPNG("test.png")
nacre
dim(nacre)
# show the full RGB image
grid.raster(nacre)
# show the 3 channels in separate images
nacre.R = nacre
nacre.G = nacre
nacre.B = nacre
# zero out the non-contributing channels for each image copy
nacre.R[,,2:3] = 0
nacre.G[,,1]=0
nacre.G[,,3]=0
nacre.B[,,1:2]=0
# build the image grid
img1 = rasterGrob(nacre.R)
img2 = rasterGrob(nacre.G)
img3 = rasterGrob(nacre.B)
grid.arrange(img1, img2, img3, nrow=1)
# Now let’s segment this image. First, we need to reshape the array into a data frame with one row for each pixel and three columns for the RGB channels:
# reshape image into a data frame
df = data.frame(
red = matrix(nacre[,,1], ncol=1),
green = matrix(nacre[,,2], ncol=1),
blue = matrix(nacre[,,3], ncol=1)
)
### compute the k-means clustering
K = kmeans(df,4)
df$label = K$cluster
### Replace the color of each pixel in the image with the mean
### R,G, and B values of the cluster in which the pixel resides:
# get the coloring
colors = data.frame(
label = 1:nrow(K$centers),
R = K$centers[,"red"],
G = K$centers[,"green"],
B = K$centers[,"blue"]
)
# merge color codes on to df
df$order = 1:nrow(df)
df = merge(df, colors)
df = df[order(df$order),]
df$order = NULL
# get mean color channel values for each row of the df.
R = matrix(df$R, nrow=dim(nacre)[1])
G = matrix(df$G, nrow=dim(nacre)[1])
B = matrix(df$B, nrow=dim(nacre)[1])
# reconstitute the segmented image in the same shape as the input image
nacre.segmented = array(dim=dim(nacre))
nacre.segmented[,,1] = R
nacre.segmented[,,2] = G
nacre.segmented[,,3] = B
# View the result
grid.raster(nacre.segmented)
누군가 트랙이나 아이디어가 있습니까? 어떤 도움 감사합니다 ..
"새우에서 동등한 원을 얻음"에 대한 정확한 인용문/기사를 제공 할 수 있습니까? 나는 "Alçiçek & Balaban 2012"신문을 들여다 보았다. 그리고 그 그림은 거기에 없다! – Daniel
@Daniel, 기사에 대한 좋은 링크가 있습니다. (불행히도, 나는 2 개의 게시물과 10 개의 평판을 얻기 전에 URL 링크를 게시 할 수 없습니다. 그 이유는 다른 사람들이 볼 수없는 이유입니다. ..) http://s3.amazonaws.com/academia.edu.documents/41113722/tiger_prawn.pdf?AWSAccessKeyId=AKIAIWOWYYGZ2Y53UL3A&Expires=1486502777&Signature=ZcX1eV8nqS1%2BYRSgvJZyAURvCwo%3D&response-content-disposition=inline%3B%20filename%3DVisual_Attributes_of_Hot_Smoked_King_Sal. pdf –
OK, 고맙습니다. 참조를 업데이트했습니다! – Daniel