quad2dat program


quad2dat program
#1
I am still discovering the programs that are present for all users.
Recently i read a lot of the program quad2dat.
But i am unable to find/download this.
Does anyone else know a solution to have a picture of a part and convert this to MLcad usable file?
Rempie

Lego omnia vincit (Lego conquers all), pro fide lege et Lego (For Faith, Justice, and lego)
Reply
Re: quad2dat program
#2
LD Pattern Creator the the todays tool for that task Smile
Reply
Re: quad2dat program
#3
gonna have a try with that.
Rempie

Lego omnia vincit (Lego conquers all), pro fide lege et Lego (For Faith, Justice, and lego)
Reply
Re: quad2dat program
#4
Remco Canten Wrote:Does anyone else know a solution to have a picture of a part and convert this to MLcad usable file?

Try the Sticker Generator, which is part of the AIOI.

w.
LEGO ergo sum
Reply
Re: quad2dat program
#5
I just tried Sticker Generator here on my Win8 system.

I had to save the scanned picture as 8bit bmp to get at least a worse result (with other depth the program crashed!).

So I think Sticker Generator is not the tool we can use nowadays Sad.

Or does anybody have a good idea what is wrong ? I remember that under WinXP I had not that bad experience.
Reply
Re: quad2dat program
#6
I can't even get it to work at all on my Win 7 (64).
Code:
[size=x-small]---------------------------
Sticker_Generator
---------------------------
Run-time error '339':

Component 'COMDLG32.OCX' or one of its dependencies not correctly registered: a file is missing or invalid
---------------------------
OK  
---------------------------[/size]
Reply
Re: quad2dat program
#7
Your message is different from mine!

So on my end it needs to be another problem. I know I have the "comdlg32.ocx" on my system. So ...?

I am just coding a little bit with vb.net to see how it might work Smile
Reply
Re: quad2dat program
#8
I have it to. I followed the instructions in the Read me-file. Didn't work.
Reply
Re: quad2dat program
#9
So far I got good results in my attempt to build something like sticker generator under vb.net, but as assumed the filesize is very large, due to one quad per pixel.

Now I am faced to challenges:
1) redirect colours to LDraw colours.
2) minimize number of quads in combining those with the same colour if possible.

If someone has a good idea for one or both of the above points I am very happy.


Attached Files
.dat   test2.dat (Size: 4.05 MB / Downloads: 0)
Reply
Re: quad2dat program
#10
You might talk to Jim DeVona. He wrote a program to do that in Perl, called Bitsticker:

http://anoved.net/software/ldraw/bitsticker/

He retired the program, but made the source available. I don't think it supports quad joining, but I do think it supports color substitution.
Reply
Re: quad2dat program
#11
Thanks for mention this. I did know that program but never used it.

This seems to be perfect for matching the colors to our palette. Recoding in VB.NET is also very easy. I should have soon results Smile

Ok, I have results, but it looks not very nice Sad
Reply
Re: quad2dat program
#12
I think the problem I am faced are well known, but I like to write them down, so we can discuss them.

My quick hack in vb.net looks for each pixel and generates a line type 4 of it.
By doing this also a little sticker takes a couple of KB/MB.
To minimize the size I need to combine the little quads as far as possible.
To do this, I need to have the colour adjusted, because only quads with the same colour can be combined.
Due to the scanning with 256 colours there are, also in plain white and blue (f.e) many differenct white and blue values.
But how should I (by application) decide which colour is the right one? - I do not know.

The colour mapping to existing LDraw colours did not what I expected (there are still too many colours envolved and the formerly nearly one colour surface is brocken because some colours are matched to dark color value and other to light colour value, so visible it distorted the picture).

So I think the best way for a sticker is to leave the colours like they are scanned.

To minimize the filesize in my opinion it is the best to scan each line, and if the neighbour quad has the same colour combine them. (I did not code this yet). This should (I guess) cut the number of lines by 50%.

If somebody has a better idea, please let me know.
Reply
Re: quad2dat program
#13
Hi Mike,

Here is how to reduce the number of colours via quantization.

http://micro.magnet.fsu.edu/primer/java/...index.html

That should at least help you get the number of colours down so you can combine quads better Smile

Tim
Reply
Re: quad2dat program
#14
I haven't seen your image file, but I think starting with a 256-color image might be exacerbating the problem. The original full-color file already had to be down-sampled to get to 256 colors. Depending on the algorithm used to do that, and the source image file, this could introduce significant color shifts. Applying the full LDraw spectrum to that color-shifted file could make things worse.
Reply
Re: quad2dat program
#15
Hey,

Michael Heidemann Wrote:The colour mapping to existing LDraw colours did not what I expected (there are still too many colours envolved and the formerly nearly one colour surface is brocken because some colours are matched to dark color value and other to light colour value, so visible it distorted the picture).

So I think the best way for a sticker is to leave the colours like they are scanned.

I do not agree. The results would be much better, if you only quantize with the colors you are expecting in the results. In your example this would only be white and blue (and green?). Some time ago I experimented with a similar task. I wrote a tool where you can choose the colors for the color quantization on the original image by mouse click.

Michael Heidemann Wrote:To minimize the filesize in my opinion it is the best to scan each line, and if the neighbour quad has the same colour combine them. (I did not code this yet). This should (I guess) cut the number of lines by 50%.

This would still guide to many quads and, I think, many t-junctions.

For this issue, I choose another way. I use the color reduced image as input for an algorithm that I derived from potrace: Walk around the same colored areas (pixel by pixel) and memorize the paths. In a few following steps I try to simplify and smooth these paths (more or less). The result is used as input for the tool triangle (this is also used in txt2dat).

I will try to give you in example shortly.

Rolf
Reply
Re: quad2dat program
#16
Hey,

so, here comes the example:
I made a screenshot from this photo and saved it as bmp. I opened it with my tool and selected three colors: black, yellow and pseudo white. Unfortunately, there are always some small slopes and dales which needs some kind of a postproduction (in this example I made none).

[Image: Img3Ldr.PNG]
Left is the original image; right the quantized one.

This is the basis for the path finding. You can see the result of the path finding in the attached LDraw-File Step3.ldr (Each path has a different color and a different z-coordinate).

In further steps the tool splits, if needed, the closed paths, removes redundant paths and tries to simplify them (Step6.ldr). These processed paths are the input for the mentioned tool triangle. Unfortunately, a postproduction would be nice to have here again. You can see the result in Clipboard02.dat.

Rolf


Attached Files
.ldr   Step6.ldr (Size: 4.49 KB / Downloads: 0)
.dat   Clipboard02.dat (Size: 15.57 KB / Downloads: 0)
.ldr   Step3.ldr (Size: 19.61 KB / Downloads: 0)
Reply
Re: quad2dat program
#17
You're a champion. I tried to do this same process many years ago, but the end results worked only on very simple parts. You seem to have mastered it.

Tim
Reply
Re: quad2dat program
#18
This is extremely interesting! I thought for a long time that this kind of approach was feasible (especially the use of Triangle library), but my software skills were too poor... you made my dreams come true!
Reply
Re: quad2dat program
#19
Hi Rolf,
Any progress with this tool? I guess many people would like to try it...
Reply
Re: quad2dat program
#20
Hey Philo,

sorry about the late response. It has been a long time since I have been working on that tool. Its current state is not very user friendly and the results are not good enough in my opinion. You could say it is in a pre alpha state: there are still hard-coded paths in the program. Also I have to deal with the licenses of "triangle" before publication.

I will try to focus more on the tool in my spare time again. But please do not expect too much from the results.

Rolf
Reply
Re: quad2dat program
#21
OK, thanks Rolf for the update!
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)
Forum Jump:


Users browsing this thread: 1 Guest(s)