Skip to content

Commit

Permalink
Merge pull request #4 from yoavram/ref-bug
Browse files Browse the repository at this point in the history
Fix ref area bug
  • Loading branch information
Yoav Ram committed Nov 1, 2015
2 parents b0912a3 + e34d0ba commit bb58f55
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include setup.py setup.cfg README.md LICENCE.txt MANIFEST.in PKG-INFO environment.yml
include versioneer.py
include Sid/_version.py
include images/0615-1.jpg
include images/0615-2.jpg
include images/0615-3.jpg
include images/image1.jpg
include images/image2.jpg
include images/image3.jpg
include Sid/take_cover.json
Binary file removed Sid/images/0615-1.jpg
Binary file not shown.
Binary file removed Sid/images/0615-2.jpg
Binary file not shown.
Binary file removed Sid/images/0615-3.jpg
Binary file not shown.
Binary file added Sid/images/image1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sid/images/image2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sid/images/image3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Sid/take_cover.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"min_otsu_th": 0.75,
"cover_th": 0.45,
"ref_th": 200,
"ref_binary_opening": 2,
"binary_opening_size": 2,
"binary_opening_iters": 10,
"eliosom_th_factor": 1.2,
Expand Down
9 changes: 4 additions & 5 deletions Sid/take_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,18 @@ def process_image(image_id):
ax[2, 1].text(0.1, 0.5, "This plot left blank")

# measure square
image_yellow = image_rgb[:, :, 2] > 200
image_yellow = image_rgb[:, :, 2] > CONFIG["ref_th"]
plot_image(image_yellow, ax[3, 0], title="yellow mask")
image_yellow = binary_opening(image_yellow, square(1), 10)
image_yellow = binary_opening(image_yellow, square(CONFIG["ref_binary_opening"]), 10)
image_yellow = image_yellow ^ bg_no_dilation
image_yellow = erosion(image_yellow, square(3))
#plot_image(image_yellow, ax[3, 1], title="yellow xor bg")
labels_yellow,n_yellow = label(~image_yellow)
labels_yellow,n_yellow = label(image_yellow)
regions_yellow = measure.regionprops(labels_yellow)
regions_yellow.sort(key=lambda x: x.area, reverse=True)
plot_image(labels_yellow, ax[3, 1], title="yellow ref")

# final
#print "final"
# final
output_img = image_rgb.copy()
output_img[:, :] = (0, 0, 0)
output_img[cover_mask] = (0, 255, 0)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
include_package_data=True,
package_data={
'Sid.images': [
'0615-1.jpg',
'0615-2.jpg',
'0615-3.jpg'
'image1.jpg',
'image2.jpg',
'image3.jpg'
],
'Sid': [
'take_cover.json'
Expand Down

0 comments on commit bb58f55

Please sign in to comment.