私はquantifying colors in an image
としたいと思います。 私は真珠の真珠光沢(真珠の母)を研究していますが、このシェル(例えば上のリンクの右の写真)の3色(赤、黄色、緑色)を定量化したいと思います。だから、イメージからの色抽出、定量および分析R
、私はいくつかのパッケージ(imager
、ImageMagick
、EBImage
を...)テストだったが、私は本当に私を助けて何かを見つけることができません。
まあ、をR
に、円で色分けしたいと思います。画素内のプリミティブの面積は、等価な表面積の円の面積として表すことができる。プリミティブは、類似の色の隣接画素の連続領域である。円の中心はアンカーピクセルになります。 [ - ² - (Ganchor - GI)² - (Banchor - BI)²(RI 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
@ダニエル、記事への良いリンクがあります(残念ながら、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