14
$\begingroup$

Bug introduced in 10.2, fixed in 11


HighlightImage is supposed to work with graphics-primitives like Line and Circle too. Very simple examples show, that this does not work consistently.

The documentation clearly indicates, that it should be possible to call (omitting the Graphics!)

HighlightImage[img, Rectangle[{132.5, 88.5}, {220.5, 176.5}], ...]

but if you try it, surprising results are thrown at you. Please look at the differences:

img = Image[Table[i, {i, 0, 255}, {256}], "Byte"];
lines = Table[Line[{{i, 1}, {i, 256}}], {i, 1, 256, 8}];
HighlightImage[img, lines]
HighlightImage[img, Graphics[lines]]

(this seems to work in version 10.3)

Mathematica graphics Mathematica graphics

One is missing lines and the other one is blurry (although we have perfect pixel positions). A even more amusing one is this

HighlightImage[img, lines, "HighlightColor" -> Blue, Method -> {"Boundary", 1}]

Mathematica graphics

In version 10.3, this call returns an error

Mathematica graphics

Additionally, there seems to be issues regarding the rasterization-quality

circles = Table[Circle[{128, 128}, r], {r, 1, 128, 10}];
HighlightImage[img, circles]
HighlightImage[img, Graphics@circles]

Mathematica graphics Mathematica graphics

This looks like it was not well tested before thrown at users. I needed the highlighting with lines and ended up writing the 10 lines of code myself, after fiddling around with HighlightImage for half an hour.

$\endgroup$
  • 2
    $\begingroup$ To meet the requirements for the bugs tag, let's state for the record that I encountered this bug under v10.2 Win7-64 as well, though my first picture looks slightly different. $\endgroup$ – Sjoerd C. de Vries Jul 26 '15 at 19:34
  • 2
    $\begingroup$ @SjoerdC.deVries I'm very generous with the bug-tag when I'm sure it is not intended behavior and the margin for it being a feature is impossibly small :-) Btw, I encountered the issue at work on OSX and wrote this post with images generated at home on Linux. But thanks very much for testing it. $\endgroup$ – halirutan Jul 26 '15 at 20:48
  • $\begingroup$ 10.3 issues are fixed in 10.4 (or earlier). $\endgroup$ – kirma Mar 2 '16 at 16:34
4
$\begingroup$

Response from support@wolfram.com:

Thanks for contacting Wolfram Technical Support and for taking the time to send in the report. This is indeed a wrong behaviour of HighlightImage, specifically for how it deals with regions. I've filed an incidence report and I will keep you posted for any updates on this issue.

Thanks again for bringing the issue to our attention, most appreciated.

Update

It's a bit late, but for completeness, I want to mention that the issues above have been fixed and work properly in 11.3 (maybe in earlier 11 versions as well).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.