2014-10-07 09:38:58 -0600 | received badge | ● Teacher (source) |
2014-10-07 08:24:11 -0600 | commented answer | Thresholding + masking image erratic results I agree, but sometimes convenience conquers all ;-) |
2014-10-07 07:45:49 -0600 | received badge | ● Self-Learner (source) |
2014-10-07 07:42:22 -0600 | answered a question | Thresholding + masking image erratic results As mentioned in discussion under my other answer, the problems most likely arose from either a bug or corruption in the OpenCV-library I used (v2.3.1-11, prebuilt from 64bit Debian Wheezy repositories). Building latest version from source fixed my issues, although the method for mask/threshold described in my other answer seems easier and more semantic code wise. |
2014-10-06 11:37:43 -0600 | commented answer | Thresholding + masking image erratic results Just tested the above script on a fresh download of windows binaries, and it shows no corruption. Must be my install then, or a fixed bug in an earlier version (v2.3.1 vs. v2.4.9). I'll try doing a fresh build on my Debian box. UPDATE: Confirmed. Fresh build of 2.4.9 on the same system works flawlessly. Thanks for guidance! Should I make a separate answer for this? |
2014-10-06 09:29:05 -0600 | commented answer | Thresholding + masking image erratic results Thank you for your reply, @thdrksdfthmn (btw - did you make that nick only to make it hard to spell? ;P ). It's possible. I'm thinking it may be a threading issue too...? To be frank I'm clueless, for even between single, individual processes output can vary. Both opencv-core and python wrapper are v2.3.1-11, prebuilt from 64bit Debian Wheezy repositories. |
2014-10-04 07:04:05 -0600 | answered a question | Thresholding + masking image erratic results TLDR; LONG VERSION; Ok, I have still to figure out why the results are not consistent between each function call (help?) but my method of thresholding and masking seems to be either horrendously outdated or just plain wrong. I was looking for methods on how to perform thresholding, and the closest thing I found was by using the This was overly complicated, whereas the code I needed was simply: Where ThresholdedImage retains original background. Hope this helps someone else... |
2014-10-01 13:58:08 -0600 | commented question | Thresholding + masking image erratic results Yes, the mask is one channel. mask.shape == (258, 258) implies (258,258,1). Sorry for not being clear. If I can supply any other helpful information let me know. I've solved the issue for now by using a min/max operation on the image and a 3-channel version of the 1 channel mask mentioned above. |
2014-10-01 10:27:36 -0600 | commented question | Thresholding + masking image erratic results image.shape == (258,258,3) mask.shape == (258,258) Since the mask is binary, the colorspace of this shouldn't matter, no? |
2014-10-01 07:50:26 -0600 | commented question | Thresholding + masking image erratic results @thdrksdfthmn: Thnx for tips. The corruption appears when applying the mask - at the bitwise_and. None image instances ahead of that are corrupt. |
2014-10-01 03:24:47 -0600 | commented question | Thresholding + masking image erratic results @StevenPuttemans - Copy/Pasted from my code, yes. I am the 'original author'. How is this not standard functionality? Not saying it definitely isn't, just wondering why it wouldn't be. I'll edit post to show precisely which methods/operations are relevant, just to be safe :+) @thdrksdfthmn Yes, dimensionality may be cause, but where does it get the hickups? |
2014-10-01 02:15:28 -0600 | received badge | ● Organizer (source) |
2014-10-01 01:17:10 -0600 | received badge | ● Editor (source) |
2014-10-01 01:15:55 -0600 | asked a question | Thresholding + masking image erratic results Hi! I'm trying to threshold + mask this image: However, using the code below this produces erratic and random images: I'm guessing it has something to do with the binary header imprinted in beginning of the produced images, however, I'm not where they are coming from. Also, considering that the images change randomly, the header is to some extent unique for each image (EDIT: To clarify: using same code and input image, the output is not consistent for each conversion). <UPDATE>: This is the part of the code which errs: Now I'd assume the operation for e.g. element at index 1 (150) is evaluated as follows: And that holds true. However, this is what I get for element at index 2 (100), at different (but with identical parameters) function calls: and and What am I missing here? </UPDATE> The input image is an RGB (no alpha) and the thresholds are all positive. Any insights are most welcome! (EDIT: As per comments, the full code may be a bit verbose - so now listing relevant pieces first, full code below:) Full code: (more) |