MATLAB: How to control the thickness of the lines in IMCROP and IMFREEHAND in Image Processing Toolbox 6.0 (R2007b)

Image Processing Toolbox

I would like to control the thickness of the lines created when I use IMCROP and IMFREEHAND:
figure, imshow('pout.tif');
h = imfreehand(gca);

Best Answer

The ability to control the thickness of the lines in IMCROP and IMFREEHAND is not available in Image Processing Toolbox 6.0 (R2007b).
To work around this issue, perform the steps outlined below. Note that although effective in Image Processing Toolbox 6.0 (R2007b), these procedures are undocumented and are not expected to work in any other version of the Image Processing Toolbox.
To change the thickness of the line used by IMCROP:
1. Execute the commands
A = which('-all', 'wingedRect');
edit(A{:})
at the MATLAB command prompt. This will open a file called "wingedRect" in the MATLAB editor.
2. Go to line 61, which should read:
'LineWidth', 3*line_width, ...
and change it to instead read:
'LineWidth', 1*line_width, ...
3. Save the file by clicking on the "disk" icon in the MATLAB editor, and close the editor.
4. Use IMCROP as usual. The bounding box should now be 1 pixel thick.
To change the thickness of the line used by IMFREEHAND:
1. Execute the commands
A = which('-all', 'polygonSymbol');
edit(A{:})
at the MATLAB command prompt. This will open a file called "polygonSymbol" in the MATLAB editor.
2. Go to lines 35 AND 52, which should both read:
'LineWidth', 3*line_width, ...
and change them both to instead read:
'LineWidth', 1*line_width, ...
3. Save the file by clicking on the "disk" icon in the MATLAB editor, and close the editor.
4. Use IMFREEHAND as usual. The bounding curve should now be 1 pixel thick.
To change the thickness of the line used by IMFREEHAND in Image Processing Toolbox 6.3 (R2009a):
1. Execute the commands
A = which('-all', 'freehandsymbol');
edit(A{:})
at the MATLAB command prompt. This will open a file called "polygonSymbol" in the MATLAB editor.
2. Go to lines 42 AND 59, which should both read:
'LineWidth', 3*line_width, ...
and change them both to instead read:
'LineWidth', 1*line_width, ...
3. Save the file by clicking on the "disk" icon in the MATLAB editor, and close the editor.
4. Use IMFREEHAND as usual. The bounding curve should now be 1 pixel thick.