質問編集履歴
4
kaizen
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,13 +28,17 @@
|
|
28
28
|
|
29
29
|
background_thresh = np.where(gray<σl,0,255).astype(np.uint8)
|
30
30
|
|
31
|
-
for x in range(τ,i
|
31
|
+
for x in range(τ,picture.shape[0]-τ):
|
32
32
|
|
33
|
-
for y in range(τ,i
|
33
|
+
for y in range(τ,picture.shape[1]-τ):
|
34
34
|
|
35
35
|
if background_thresh[x,y]:
|
36
36
|
|
37
|
+
pixel = gray[x,y]
|
38
|
+
|
39
|
+
|
40
|
+
|
37
|
-
pix_candicate[x,y] = ((((
|
41
|
+
pix_candicate[x,y] = ((((pixel-gray[x+τ,y])>σd) and ((pixel-gray[x-τ,y])>σd)) or (((pixel-gray[x,y+τ])>σd) and ((pixel-gray[x,y-τ])>σd)))
|
38
42
|
|
39
43
|
else:
|
40
44
|
|
3
書式
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
pythonの画像処理を高速化したいです。f(x,y)をそのピクセルの画素値,l(x,y)は1だったら白、0だったら黒として![イメージ説明](873e9829421d977eb30fab7707d25ee5.png)
|
6
6
|
|
7
|
-
このような処理を達成するために下のコードを書いたのですが、二重ループが入っているので遅く、高速化したいです。
|
7
|
+
このような処理を達成するために下のコードを書いたのですが、二重ループが入っているので遅く、高速化したいです。どのように改善したら良いか、どのようなモジュールを使えばいいか、ご教示ください。
|
8
8
|
|
9
9
|
|
10
10
|
|
2
文法
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,14 +30,14 @@
|
|
30
30
|
|
31
31
|
for x in range(τ,img.shape[0]-τ):
|
32
32
|
|
33
|
-
|
33
|
+
for y in range(τ,img.shape[1]-τ):
|
34
34
|
|
35
|
-
|
35
|
+
if background_thresh[x,y]:
|
36
36
|
|
37
|
-
|
37
|
+
pix_candicate[x,y] = ((((gray[x,y]-gray[x+τ,y])>σd) and ((gray[x,y]-gray[x-τ,y])>σd)) or (((gray[x,y]-gray[x,y+τ])>σd) and ((gray[x,y]-gray[x,y-τ])>σd)))
|
38
38
|
|
39
|
-
|
39
|
+
else:
|
40
40
|
|
41
|
-
|
41
|
+
pix_candicate[x,y] = 0
|
42
42
|
|
43
43
|
```
|
1
ごじ
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
画像処理の二重ループの解消
|
1
|
+
[Python] 画像処理の二重ループの解消
|
test
CHANGED
File without changes
|