Help with Trace Bitmap - New Feature

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Help with Trace Bitmap - New Feature

Post by John Hyslop » Fri Oct 07, 2022 1:31 am

Hi Andrew

QcadCAM Version: 3.27.8.0
Build Date: Oct 6 2022
Revision: dea3962
Qt Version: 5.14.2
Architecture: x86_64
Compiler: gcc 5.4.0

OS: Linux Mint 20.3 x86_64
And
OS: Windows 10 Pro 64bit

This is a well welcomed feature in Qcad but I seem to be having trouble with it.. :?
.
I've looked at the Help file but I need some guidance on the actual settings for tracing.
Below is an example from Inkscape v1.1 Appimage "I have used this for years" the Trace Bitmap settings are default values.. I tied default values in Qcad but could not achieve the desired result, I also tried setting to monochrome and played around with the thresholds but it shows a black screen and on an odd occasion locks up... :(
.
Any help will be much appreciated and I'm very happy that this feature will now be a part of Qcad :)
.
Please see below sample screenshots, image file used "Face.png" and dxf output from Inkscape...
.
Cheers
John
PS FYI I had the same issue with previous Qcad Build 3.27.7
.
Face.png
Face.png (123.91 KiB) Viewed 4169 times
InkScapeTraceBitMap.dxf
(514.2 KiB) Downloaded 232 times
QcadTraceBitMap.png
QcadTraceBitMap.png (138.91 KiB) Viewed 4169 times
TraceBitMapMonochrome.png
TraceBitMapMonochrome.png (8.46 KiB) Viewed 4169 times
QcadTraceBitMap-1.png
QcadTraceBitMap-1.png (88.93 KiB) Viewed 4169 times
Last edited by John Hyslop on Fri Oct 07, 2022 6:03 am, edited 2 times in total.
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4939
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Help with Trace Bitmap - New Feature

Post by Husky » Fri Oct 07, 2022 2:51 am

Hi John,
John Hyslop wrote:
Fri Oct 07, 2022 1:31 am
I tied default values in Qcad but could not achieve the desired result, I also tried setting to monochrome and played around with the thresholds but it shows a black screen and on an odd occasion locks up... :(
To get you started try this settings ...

Husky-2022.10.06-06.png
Husky-2022.10.06-06.png (224.81 KiB) Viewed 4156 times

... what will produce something like this

Husky-2022.10.06-07.png
Husky-2022.10.06-07.png (200.88 KiB) Viewed 4156 times
I'm sure there is room for improvement but right now I don't have the time to play with it ... :oops:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: Help with Trace Bitmap - New Feature

Post by John Hyslop » Fri Oct 07, 2022 5:12 am

Hi Husky

Thanks for the fast response but I still cannot get this to work...
See video attached..
Cheers
John
simplescreenrecorder-2022-10-07_15.07.24.mkv.zip
(1.67 MiB) Downloaded 234 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: Help with Trace Bitmap - New Feature

Post by John Hyslop » Fri Oct 07, 2022 5:19 am

Hi Husky

Okay I got this to work... but only after applying the default settings 1st
then changing them as per your suggestion..?
Is there a reason we need to update with defaults 1st then change?
I'm marking this solved.. because it does work but only if you do as above..

Thank you very much.. you've made my day :D

Cheers
John
Screenshot from 2022-10-07 15-18-43.png
Screenshot from 2022-10-07 15-18-43.png (111.51 KiB) Viewed 4147 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re: [ALMOST SOLVED] Help with Trace Bitmap - New Feature

Post by John Hyslop » Fri Oct 07, 2022 5:42 am

Hi Husky

It is a bit buggy though... for instance when monochrome is unticked alpha and brightness are not available :?
but when ticked they are ? should it not be the other way around?
Please see gif below..

Cheers
John
Peek 2022-10-07 15-38.gif
Peek 2022-10-07 15-38.gif (114.25 KiB) Viewed 4143 times
BUG e_surprised
Peek 2022-10-07 15-51.gif
Peek 2022-10-07 15-51.gif (186.9 KiB) Viewed 4142 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

John Hyslop
Premier Member
Posts: 474
Joined: Mon Sep 30, 2019 6:21 am
Location: Melbourne - Australia

Re:Help with Trace Bitmap - New Feature

Post by John Hyslop » Fri Oct 07, 2022 6:01 am

Sorry... :cry: I found more bugs... :(
inconsistent results with same values entered
Here's the file I tested with...
star.jpeg
star.jpeg (63.88 KiB) Viewed 4138 times
Peek 2022-10-07 15-59.gif
Peek 2022-10-07 15-59.gif (168.28 KiB) Viewed 4138 times
Cheers
John
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: Help with Trace Bitmap - New Feature

Post by CVH » Mon Oct 10, 2022 6:04 am

John Hyslop wrote:
Fri Oct 07, 2022 5:42 am
for instance when monochrome is unticked alpha and brightness are not available
Essentially, 'Monochrome' means in shades of 1 color, In that case one has to define what shades to include/exclude.
I suspect that the number of colors doesn't matter at that point.
In Peek 2022-10-07 15-38.gif, not monochrome and 2 colors it selects everything In white + black including gray or whole the bitmap.

Ticking 'Monochrome' here means that your bitmap RGB is turned into grayscale (8 BitsPerPixel) on the fly.
The weighted method would be Y = 0.299R + 0.587G + 0.114B e_geek
From the help file it is clear that the 'Brightness Threshold' then defines what shade of gray is considered background.
For RGBA there is the A-channel threshold (transparency).
But both 'Thresholds' then speak of all black, all white what in essence is black/white (1 BitsPerPixel).
John Hyslop wrote:
Fri Oct 07, 2022 6:01 am
inconsistent results with same values entered
Indeed, one would expect the same results from the same settings. :roll:

Remark that you ask to reduce the color depth to 3 colors and there are indeed 3 spikes in the Histogram:
White, black and the gray from the checker board, all three with some nuances.
Jpeg files are not ideal sources because of the decompression artifacts, there are 220 unique colors in the star example.
What threshold is used for a certain color depth eludes me.
John Hyslop wrote:
Fri Oct 07, 2022 5:19 am
Is there a reason we need to update with defaults 1st then change?
I think not, but it might simply be the 'inconsistent results' and with what you start with. :wink:
Fully testing this new QCAD feature would require consistent results. :!:


QCAD trace path is nothing similar or close to Inkscape Trace path.
The latter will export splines while QCAD sticks to polylines.
If we overlay the dxf over the Face.png (scaled 0.75), it is obvious that Inkscape draws an envelope around darker regions.
For this every pixel is locally weighted regarding their neighbors.
That picture has 397 unique colors.
Still, at some points Inkscape soften corners where we see/suspect hard corners.


I am more troubled with the fact that it locks up when no image is selected. :shock:
QQ is needed to terminate the tool. :wink:

Script based:
Rather odd that any entity type is welcome for the prevImageEntity variable.
With a multiple selection the odds are against us that the first queried entity id is indeed the intended image.
In debugger mode an uncaught exception is thrown without an image entity, the script simply halts at that point.

Starting the tool doesn't display a preview image,
That figures because the preview, a scaled image + trace, is only generated when hitting the 'Update' button.
On would expect the dialog to open with the image ... Without tracing.

Further, I suspect the preview to be not consistent with the final result.
The preview trace is preformed on a QImage scaled to fit 256 by 256 pixels preserving the aspect ratio.
The final result is preformed on the actual image file of all selected images.
A scaled bitmap is never equal to the original, that all depends on the algorithm that is used.
Face.png is 446 x 380 px and star.jpeg is 728 x 508 px

Regards,
CVH

Post Reply

Return to “QCAD Troubleshooting and Problems”