Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39146 > unrolled thread
| Started by | K R <rob99999999999999999@gmail.com> |
|---|---|
| First post | 2020-11-15 11:00 -0800 |
| Last post | 2020-12-23 11:30 -0800 |
| Articles | 20 on this page of 27 — 7 participants |
Back to article view | Back to comp.lang.javascript
Near random colors to picture pixels, so that same color matches same random color. K R <rob99999999999999999@gmail.com> - 2020-11-15 11:00 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-11-15 11:07 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-22 09:29 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-12-22 11:35 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Richard Damon <Richard@Damon-Family.org> - 2020-12-22 14:58 -0500
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-23 11:15 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-23 11:17 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Richard Damon <Richard@Damon-Family.org> - 2020-12-23 15:23 -0500
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-24 01:10 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-24 01:11 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <iiiiiiiiiiiia@bestmail.us> - 2020-12-24 04:49 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <iiiiiiiiiiiia@bestmail.us> - 2020-12-24 05:46 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-24 10:53 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-12-25 09:33 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <iiiiiiiiiiiia@bestmail.us> - 2020-12-25 23:17 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <iiiiiiiiiiiia@bestmail.us> - 2020-12-25 23:18 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <iiiiiiiiiiiia@bestmail.us> - 2020-12-25 23:33 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-12-26 08:30 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-27 07:57 -0800
If somebody reads this again ..... I A <he12457@hotmail.com> - 2021-02-14 09:24 -0800
Re: If somebody reads this again ..... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-02-15 05:55 -0800
Re: If somebody reads this again ..... Minai Robam <mi23523523@fastmail.com> - 2021-03-30 09:02 -0700
Re: If somebody reads this again ..... Minai Robam <mi23523523@fastmail.com> - 2021-03-30 09:37 -0700
Re: If somebody reads this again ..... Minai Robam <mi23523523@fastmail.com> - 2021-03-30 09:39 -0700
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-23 11:24 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-23 11:27 -0800
Re: Near random colors to picture pixels, so that same color matches same random color. Kristjan Robam <jippii1291983@gmail.com> - 2020-12-23 11:30 -0800
Page 1 of 2 [1] 2 Next page →
| From | K R <rob99999999999999999@gmail.com> |
|---|---|
| Date | 2020-11-15 11:00 -0800 |
| Subject | Near random colors to picture pixels, so that same color matches same random color. |
| Message-ID | <5c0399a6-d083-4269-b25b-5ce92f91ba2an@googlegroups.com> |
Anyone can point to a place, where to download code for this ? KR Ph.: 372 57865442 E-m.: mi23523523 fastmail c o m
[toc] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2020-11-15 11:07 -0800 |
| Message-ID | <0fa596ff-6c12-4626-9a39-172f47d91514n@googlegroups.com> |
| In reply to | #39146 |
On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote: > Anyone can point to a place, where to download code for this ? > I don't know what you mean. Can you give more details?
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-22 09:29 -0800 |
| Message-ID | <f38b61f2-9490-4175-8880-fdbc26b9cdc9n@googlegroups.com> |
| In reply to | #39148 |
Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2: > On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote: > > Anyone can point to a place, where to download code for this ? > > > I don't know what you mean. Can you give more details? What I want to say is the following. Function: Renewing each picture color. New picture colors must satisfy this: 1. Each pixel color goes to random. 2. Each same color pixel goes to same color, that is defined in point 1. Basically what you would need is a reminder of assigned colors of picture pixels. Actually I got that one programmed as far as I remember. But what I would now need very much is a function, that turns colors to random so, that the difference of near colors is the distance of the original colors of points A and B. If you can help me with that, I would be very thankful. Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2020-12-22 11:35 -0800 |
| Message-ID | <80cc7cee-7e60-4204-ab73-43fbef06c77an@googlegroups.com> |
| In reply to | #39289 |
On Tuesday, December 22, 2020 at 11:29:30 AM UTC-6, Kristjan Robam wrote: > [...] > > But what I would now need very much is a function, that turns colors to random so, > that the difference of near colors is the distance of the original colors of points A and B. Assuming 24 bits for color plus 8 bits for the alpha channel, a random color would be an integer between 0 and 0xFFFFFFF inclusive: ``` const randomInt = (max) => Math.floor(Math.random() * Math.floor(max)) const randomColor = randomInt(0xFFFFFFFF) ``` The second part of your sentence reads to me like you want a linear interpolation of two colors, or maybe you just want the average? ``` let avgColor = (c1,c2) => Math.floor((c1 + c2) / 2) ``` ``` const lerp = (t, a, b) => (1 - t) * a + t * b const RED = 0xFF0000FF const BLUE = 0x0000FFFF lerp(0,RED,BLUE).toString(16) // ff0000ff lerp(0.5,RED,BLUE).toString(16) // 7f80807f lerp(1,RED,BLUE).toString(16) // 0000ffff ```
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2020-12-22 14:58 -0500 |
| Message-ID | <6esEH.15528$EY1.11782@fx42.iad> |
| In reply to | #39289 |
On 12/22/20 12:29 PM, Kristjan Robam wrote: > Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2: >> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote: >>> Anyone can point to a place, where to download code for this ? >>> >> I don't know what you mean. Can you give more details? > What I want to say is the following. > Function: > Renewing each picture color. > New picture colors must satisfy this: > 1. Each pixel color goes to random. > 2. Each same color pixel goes to same color, that is defined in point 1. > > Basically what you would need is a reminder of assigned colors of picture pixels. > > > > Actually I got that one programmed as far as I remember. > > But what I would now need very much is a function, that turns colors to random so, > that the difference of near colors is the distance of the original colors of points A and B. > > If you can help me with that, I would be very thankful. > > > Kristjan Robam > If your requirements are that the 'spacing' between all colors in the original image and in the new image are preserved, your randomness is going to be greatly limited. One big question is how you want to define the distance between colors (largly which color space you want to measure in). If you presume that the image might be using a broad assortment of colors and distance measured but RGB distance, then the only general transformations that preserve distances would be swapping axis and reversing the direction of some of the axis. Some other spaces might give slightly different options, but similar, as 'Hue' based color spaces have a polar axis which behaves a bit differently than a cartisian axis so can't really swap with another axis, but can have an arbitrary offset or can be flipped (so gives more options).
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-23 11:15 -0800 |
| Message-ID | <3f997dc4-c4b3-4b4d-a078-585e3fb4a578n@googlegroups.com> |
| In reply to | #39293 |
Richard Damon kirjutas teisipäev, 22. detsember 2020 kl 21:59:08 UTC+2:
> On 12/22/20 12:29 PM, Kristjan Robam wrote:
> > Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2:
> >> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote:
> >>> Anyone can point to a place, where to download code for this ?
> >>>
> >> I don't know what you mean. Can you give more details?
> > What I want to say is the following.
> > Function:
> > Renewing each picture color.
> > New picture colors must satisfy this:
> > 1. Each pixel color goes to random.
> > 2. Each same color pixel goes to same color, that is defined in point 1.
> >
> > Basically what you would need is a reminder of assigned colors of picture pixels.
> >
> >
> >
> > Actually I got that one programmed as far as I remember.
> >
> > But what I would now need very much is a function, that turns colors to random so,
> > that the difference of near colors is the distance of the original colors of points A and B.
> >
> > If you can help me with that, I would be very thankful.
> >
> >
> > Kristjan Robam
> >
> If your requirements are that the 'spacing' between all colors in the
> original image and in the new image are preserved, your randomness is
> going to be greatly limited. One big question is how you want to define
> the distance between colors (largly which color space you want to
> measure in). If you presume that the image might be using a broad
> assortment of colors and distance measured but RGB distance, then the
> only general transformations that preserve distances would be swapping
> axis and reversing the direction of some of the axis.
>
> Some other spaces might give slightly different options, but similar, as
> 'Hue' based color spaces have a polar axis which behaves a bit
> differently than a cartisian axis so can't really swap with another
> axis, but can have an arbitrary offset or can be flipped (so gives more
> options).
Hello guys.
Richard Damon, as you said I need 'spacing' preserved. And one more requrement. When all the color areas must mach with new random colors.
It could take any color that is the same far in my color distance sense.
One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
Parimate tervitustega Eestist ( it is good hello's from Estonia),
Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-23 11:17 -0800 |
| Message-ID | <edd610b9-4984-4922-b1e6-12aa1487037dn@googlegroups.com> |
| In reply to | #39302 |
Kristjan Robam kirjutas kolmapäev, 23. detsember 2020 kl 21:15:47 UTC+2:
> Richard Damon kirjutas teisipäev, 22. detsember 2020 kl 21:59:08 UTC+2:
> > On 12/22/20 12:29 PM, Kristjan Robam wrote:
> > > Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2:
> > >> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote:
> > >>> Anyone can point to a place, where to download code for this ?
> > >>>
> > >> I don't know what you mean. Can you give more details?
> > > What I want to say is the following.
> > > Function:
> > > Renewing each picture color.
> > > New picture colors must satisfy this:
> > > 1. Each pixel color goes to random.
> > > 2. Each same color pixel goes to same color, that is defined in point 1.
> > >
> > > Basically what you would need is a reminder of assigned colors of picture pixels.
> > >
> > >
> > >
> > > Actually I got that one programmed as far as I remember.
> > >
> > > But what I would now need very much is a function, that turns colors to random so,
> > > that the difference of near colors is the distance of the original colors of points A and B.
> > >
> > > If you can help me with that, I would be very thankful.
> > >
> > >
> > > Kristjan Robam
> > >
> > If your requirements are that the 'spacing' between all colors in the
> > original image and in the new image are preserved, your randomness is
> > going to be greatly limited. One big question is how you want to define
> > the distance between colors (largly which color space you want to
> > measure in). If you presume that the image might be using a broad
> > assortment of colors and distance measured but RGB distance, then the
> > only general transformations that preserve distances would be swapping
> > axis and reversing the direction of some of the axis.
> >
> > Some other spaces might give slightly different options, but similar, as
> > 'Hue' based color spaces have a polar axis which behaves a bit
> > differently than a cartisian axis so can't really swap with another
> > axis, but can have an arbitrary offset or can be flipped (so gives more
> > options).
> Hello guys.
>
> Richard Damon, as you said I need 'spacing' preserved. And one more requrement. When all the color areas must mach with new random colors.
> It could take any color that is the same far in my color distance sense.
> One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
> It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
>
> Parimate tervitustega Eestist ( it is good hello's from Estonia),
> Kristjan Robam
Correction:
Hello guys.
Richard Damon, as you said I need 'spacing' preserved. And one more requirement. When all the color areas must mach with new random colors.
It could take any color that is the same far in my color distance sense.
One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
Parimate tervitustega Eestist ( it is good hello's from Estonia),
Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2020-12-23 15:23 -0500 |
| Message-ID | <iHNEH.37773$R82.6210@fx46.iad> |
| In reply to | #39302 |
On 12/23/20 2:15 PM, Kristjan Robam wrote:
> Richard Damon kirjutas teisipäev, 22. detsember 2020 kl 21:59:08 UTC+2:
>> On 12/22/20 12:29 PM, Kristjan Robam wrote:
>>> Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2:
>>>> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote:
>>>>> Anyone can point to a place, where to download code for this ?
>>>>>
>>>> I don't know what you mean. Can you give more details?
>>> What I want to say is the following.
>>> Function:
>>> Renewing each picture color.
>>> New picture colors must satisfy this:
>>> 1. Each pixel color goes to random.
>>> 2. Each same color pixel goes to same color, that is defined in point 1.
>>>
>>> Basically what you would need is a reminder of assigned colors of picture pixels.
>>>
>>>
>>>
>>> Actually I got that one programmed as far as I remember.
>>>
>>> But what I would now need very much is a function, that turns colors to random so,
>>> that the difference of near colors is the distance of the original colors of points A and B.
>>>
>>> If you can help me with that, I would be very thankful.
>>>
>>>
>>> Kristjan Robam
>>>
>> If your requirements are that the 'spacing' between all colors in the
>> original image and in the new image are preserved, your randomness is
>> going to be greatly limited. One big question is how you want to define
>> the distance between colors (largly which color space you want to
>> measure in). If you presume that the image might be using a broad
>> assortment of colors and distance measured but RGB distance, then the
>> only general transformations that preserve distances would be swapping
>> axis and reversing the direction of some of the axis.
>>
>> Some other spaces might give slightly different options, but similar, as
>> 'Hue' based color spaces have a polar axis which behaves a bit
>> differently than a cartisian axis so can't really swap with another
>> axis, but can have an arbitrary offset or can be flipped (so gives more
>> options).
>
> Hello guys.
>
> Richard Damon, as you said I need 'spacing' preserved. And one more requrement. When all the color areas must mach with new random colors.
> It could take any color that is the same far in my color distance sense.
> One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
> It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
>
> Parimate tervitustega Eestist ( it is good hello's from Estonia),
> Kristjan Robam
>
As I said, to map points in the RGB cube to other points in the RGB
cube, such that the spacing of all points stay the same, you are very
limited in what you can do (unless your set of colors used are very
carefully chosen).
You can first swap color axis in any of 6 way:
RGB -> RGB RBG GRB GBR BRG BGR
and then each of the 3 axis can individually be swapped end for end.
This gives 48 possible transformations and that is it.
The issue is that if you map one color at 'random', then choose a second
color from the right distance shell, and a 3rd color will be constrained
from a circle, and a forth will have just two possible values that have
the right distange. After that every point will have just a single
option that is the right distance from every other point. Then, unless
you chose the points to match one of the rules above, some of the colors
will be forced to be mapped outside the base RGB space, thus you will
need to reject that mapping. Unless the space of the input colors leaves
wiggle room inside the color cube you are stuck with just those
transformations.
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-24 01:10 -0800 |
| Message-ID | <25c10014-9f9f-4c8e-8447-2cd747085a6dn@googlegroups.com> |
| In reply to | #39307 |
Richard Damon kirjutas kolmapäev, 23. detsember 2020 kl 22:23:52 UTC+2:
> On 12/23/20 2:15 PM, Kristjan Robam wrote:
> > Richard Damon kirjutas teisipäev, 22. detsember 2020 kl 21:59:08 UTC+2:
> >> On 12/22/20 12:29 PM, Kristjan Robam wrote:
> >>> Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2:
> >>>> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote:
> >>>>> Anyone can point to a place, where to download code for this ?
> >>>>>
> >>>> I don't know what you mean. Can you give more details?
> >>> What I want to say is the following.
> >>> Function:
> >>> Renewing each picture color.
> >>> New picture colors must satisfy this:
> >>> 1. Each pixel color goes to random.
> >>> 2. Each same color pixel goes to same color, that is defined in point 1.
> >>>
> >>> Basically what you would need is a reminder of assigned colors of picture pixels.
> >>>
> >>>
> >>>
> >>> Actually I got that one programmed as far as I remember.
> >>>
> >>> But what I would now need very much is a function, that turns colors to random so,
> >>> that the difference of near colors is the distance of the original colors of points A and B.
> >>>
> >>> If you can help me with that, I would be very thankful.
> >>>
> >>>
> >>> Kristjan Robam
> >>>
> >> If your requirements are that the 'spacing' between all colors in the
> >> original image and in the new image are preserved, your randomness is
> >> going to be greatly limited. One big question is how you want to define
> >> the distance between colors (largly which color space you want to
> >> measure in). If you presume that the image might be using a broad
> >> assortment of colors and distance measured but RGB distance, then the
> >> only general transformations that preserve distances would be swapping
> >> axis and reversing the direction of some of the axis.
> >>
> >> Some other spaces might give slightly different options, but similar, as
> >> 'Hue' based color spaces have a polar axis which behaves a bit
> >> differently than a cartisian axis so can't really swap with another
> >> axis, but can have an arbitrary offset or can be flipped (so gives more
> >> options).
> >
> > Hello guys.
> >
> > Richard Damon, as you said I need 'spacing' preserved. And one more requrement. When all the color areas must mach with new random colors.
> > It could take any color that is the same far in my color distance sense.
> > One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
> > It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
> >
> > Parimate tervitustega Eestist ( it is good hello's from Estonia),
> > Kristjan Robam
> >
>
> As I said, to map points in the RGB cube to other points in the RGB
> cube, such that the spacing of all points stay the same, you are very
> limited in what you can do (unless your set of colors used are very
> carefully chosen).
>
> You can first swap color axis in any of 6 way:
>
> RGB -> RGB RBG GRB GBR BRG BGR
>
> and then each of the 3 axis can individually be swapped end for end.
>
> This gives 48 possible transformations and that is it.
>
> The issue is that if you map one color at 'random', then choose a second
> color from the right distance shell, and a 3rd color will be constrained
> from a circle, and a forth will have just two possible values that have
> the right distange. After that every point will have just a single
> option that is the right distance from every other point. Then, unless
> you chose the points to match one of the rules above, some of the colors
> will be forced to be mapped outside the base RGB space, thus you will
> need to reject that mapping. Unless the space of the input colors leaves
> wiggle room inside the color cube you are stuck with just those
> transformations.
One thing more. That may not be clear.
The new (random) colors must be map to the original colors.
With best Christmas wishes,
Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-24 01:11 -0800 |
| Message-ID | <596a9aeb-f8a6-408a-a8e1-de3cc58e3cdfn@googlegroups.com> |
| In reply to | #39316 |
Kristjan Robam kirjutas neljapäev, 24. detsember 2020 kl 11:10:54 UTC+2:
> Richard Damon kirjutas kolmapäev, 23. detsember 2020 kl 22:23:52 UTC+2:
> > On 12/23/20 2:15 PM, Kristjan Robam wrote:
> > > Richard Damon kirjutas teisipäev, 22. detsember 2020 kl 21:59:08 UTC+2:
> > >> On 12/22/20 12:29 PM, Kristjan Robam wrote:
> > >>> Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2:
> > >>>> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote:
> > >>>>> Anyone can point to a place, where to download code for this ?
> > >>>>>
> > >>>> I don't know what you mean. Can you give more details?
> > >>> What I want to say is the following.
> > >>> Function:
> > >>> Renewing each picture color.
> > >>> New picture colors must satisfy this:
> > >>> 1. Each pixel color goes to random.
> > >>> 2. Each same color pixel goes to same color, that is defined in point 1.
> > >>>
> > >>> Basically what you would need is a reminder of assigned colors of picture pixels.
> > >>>
> > >>>
> > >>>
> > >>> Actually I got that one programmed as far as I remember.
> > >>>
> > >>> But what I would now need very much is a function, that turns colors to random so,
> > >>> that the difference of near colors is the distance of the original colors of points A and B.
> > >>>
> > >>> If you can help me with that, I would be very thankful.
> > >>>
> > >>>
> > >>> Kristjan Robam
> > >>>
> > >> If your requirements are that the 'spacing' between all colors in the
> > >> original image and in the new image are preserved, your randomness is
> > >> going to be greatly limited. One big question is how you want to define
> > >> the distance between colors (largly which color space you want to
> > >> measure in). If you presume that the image might be using a broad
> > >> assortment of colors and distance measured but RGB distance, then the
> > >> only general transformations that preserve distances would be swapping
> > >> axis and reversing the direction of some of the axis.
> > >>
> > >> Some other spaces might give slightly different options, but similar, as
> > >> 'Hue' based color spaces have a polar axis which behaves a bit
> > >> differently than a cartisian axis so can't really swap with another
> > >> axis, but can have an arbitrary offset or can be flipped (so gives more
> > >> options).
> > >
> > > Hello guys.
> > >
> > > Richard Damon, as you said I need 'spacing' preserved. And one more requrement. When all the color areas must mach with new random colors.
> > > It could take any color that is the same far in my color distance sense.
> > > One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
> > > It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
> > >
> > > Parimate tervitustega Eestist ( it is good hello's from Estonia),
> > > Kristjan Robam
> > >
> >
> > As I said, to map points in the RGB cube to other points in the RGB
> > cube, such that the spacing of all points stay the same, you are very
> > limited in what you can do (unless your set of colors used are very
> > carefully chosen).
> >
> > You can first swap color axis in any of 6 way:
> >
> > RGB -> RGB RBG GRB GBR BRG BGR
> >
> > and then each of the 3 axis can individually be swapped end for end.
> >
> > This gives 48 possible transformations and that is it.
> >
> > The issue is that if you map one color at 'random', then choose a second
> > color from the right distance shell, and a 3rd color will be constrained
> > from a circle, and a forth will have just two possible values that have
> > the right distange. After that every point will have just a single
> > option that is the right distance from every other point. Then, unless
> > you chose the points to match one of the rules above, some of the colors
> > will be forced to be mapped outside the base RGB space, thus you will
> > need to reject that mapping. Unless the space of the input colors leaves
> > wiggle room inside the color cube you are stuck with just those
> > transformations.
> One thing more. That may not be clear.
> The new (random) colors must be map to the original colors.
>
> With best Christmas wishes,
> Kristjan Robam
It would be cool, if someone could just post a Javascript code for this.
Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <iiiiiiiiiiiia@bestmail.us> |
|---|---|
| Date | 2020-12-24 04:49 -0800 |
| Message-ID | <846d35c7-92e0-4236-9e6b-10cdff9a5bbcn@googlegroups.com> |
| In reply to | #39317 |
On Thursday, December 24, 2020 at 11:12:07 AM UTC+2, Kristjan Robam wrote:
> Kristjan Robam kirjutas neljapäev, 24. detsember 2020 kl 11:10:54 UTC+2:
> > Richard Damon kirjutas kolmapäev, 23. detsember 2020 kl 22:23:52 UTC+2:
> > > On 12/23/20 2:15 PM, Kristjan Robam wrote:
> > > > Richard Damon kirjutas teisipäev, 22. detsember 2020 kl 21:59:08 UTC+2:
> > > >> On 12/22/20 12:29 PM, Kristjan Robam wrote:
> > > >>> Michael Haufe (TNO) kirjutas pühapäev, 15. november 2020 kl 21:07:18 UTC+2:
> > > >>>> On Sunday, November 15, 2020 at 1:01:01 PM UTC-6, rob9999999...@gmail.com wrote:
> > > >>>>> Anyone can point to a place, where to download code for this ?
> > > >>>>>
> > > >>>> I don't know what you mean. Can you give more details?
> > > >>> What I want to say is the following.
> > > >>> Function:
> > > >>> Renewing each picture color.
> > > >>> New picture colors must satisfy this:
> > > >>> 1. Each pixel color goes to random.
> > > >>> 2. Each same color pixel goes to same color, that is defined in point 1.
> > > >>>
> > > >>> Basically what you would need is a reminder of assigned colors of picture pixels.
> > > >>>
> > > >>>
> > > >>>
> > > >>> Actually I got that one programmed as far as I remember.
> > > >>>
> > > >>> But what I would now need very much is a function, that turns colors to random so,
> > > >>> that the difference of near colors is the distance of the original colors of points A and B.
> > > >>>
> > > >>> If you can help me with that, I would be very thankful.
> > > >>>
> > > >>>
> > > >>> Kristjan Robam
> > > >>>
> > > >> If your requirements are that the 'spacing' between all colors in the
> > > >> original image and in the new image are preserved, your randomness is
> > > >> going to be greatly limited. One big question is how you want to define
> > > >> the distance between colors (largly which color space you want to
> > > >> measure in). If you presume that the image might be using a broad
> > > >> assortment of colors and distance measured but RGB distance, then the
> > > >> only general transformations that preserve distances would be swapping
> > > >> axis and reversing the direction of some of the axis.
> > > >>
> > > >> Some other spaces might give slightly different options, but similar, as
> > > >> 'Hue' based color spaces have a polar axis which behaves a bit
> > > >> differently than a cartisian axis so can't really swap with another
> > > >> axis, but can have an arbitrary offset or can be flipped (so gives more
> > > >> options).
> > > >
> > > > Hello guys.
> > > >
> > > > Richard Damon, as you said I need 'spacing' preserved. And one more requrement. When all the color areas must mach with new random colors.
> > > > It could take any color that is the same far in my color distance sense.
> > > > One base color R(red){others G and B. The alpha is not so important I think at the moment.} distance sqr((R1*R1+R2*R2)/2).
> > > > It would take the "first" found R,G,B triple, whose difference is equal to original neighbour color distance.
> > > >
> > > > Parimate tervitustega Eestist ( it is good hello's from Estonia),
> > > > Kristjan Robam
> > > >
> > >
> > > As I said, to map points in the RGB cube to other points in the RGB
> > > cube, such that the spacing of all points stay the same, you are very
> > > limited in what you can do (unless your set of colors used are very
> > > carefully chosen).
> > >
> > > You can first swap color axis in any of 6 way:
> > >
> > > RGB -> RGB RBG GRB GBR BRG BGR
> > >
> > > and then each of the 3 axis can individually be swapped end for end.
> > >
> > > This gives 48 possible transformations and that is it.
> > >
> > > The issue is that if you map one color at 'random', then choose a second
> > > color from the right distance shell, and a 3rd color will be constrained
> > > from a circle, and a forth will have just two possible values that have
> > > the right distange. After that every point will have just a single
> > > option that is the right distance from every other point. Then, unless
> > > you chose the points to match one of the rules above, some of the colors
> > > will be forced to be mapped outside the base RGB space, thus you will
> > > need to reject that mapping. Unless the space of the input colors leaves
> > > wiggle room inside the color cube you are stuck with just those
> > > transformations.
> > One thing more. That may not be clear.
> > The new (random) colors must be map to the original colors.
> >
> > With best Christmas wishes,
> > Kristjan Robam
> It would be cool, if someone could just post a Javascript code for this.
>
>
> Kristjan Robam
You could take the start code from:
https://groups.google.com/g/comp.programming/c/ch6aYxj0_RI
I just started myself programming it too.
Kristjan
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <iiiiiiiiiiiia@bestmail.us> |
|---|---|
| Date | 2020-12-24 05:46 -0800 |
| Message-ID | <84e181fa-192b-403a-8fd3-45e4227f7914n@googlegroups.com> |
| In reply to | #39319 |
What I mean is something like the following. But I haven't tested it yet.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<canvas id="canvas" width="555" height="555"></canvas>
<p></p>
<div style="display:none;">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAEYARgDAREAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9U6ACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKAEbpUTAF6UQAWrAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgBG6VEwBelEAFqwCgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoARulRMAX7oogAtNgFIAqwCpbAbx607gJuAouA1p0X7/y/wC9RcdmCzo/3PmouFmPyDRcQYHrRcB1MAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoARulRMBv8OyiAD6YBSAKGwImfa1ZtgeL/GX9pLwz8LHfTLH7NqmsRbvtFuJdq23ybl81l6M3y8VVzSNO58j+Ov2wfiX4v2239pLpEfz/ALvTWeL/AMe++9FzpjRPPbr4jeKtemV9W8SareN/A097LK6/7nzUXNfYHpHw/wDjD4q8G3H2nRPENzA0q/vY5P3sTf8AAX/iouHsEen6B+0/8S7O6Z5dQsdXgf8AetHd2+3Z/sqy7aLmUqB9B/D747+CvHEMdtLfR6Zqn3JbK4fnf/st/FRc55Umj0pWR61Mth9ABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFACN0pMAXpWbAWqAKAI3IpSi2CV9j4w/aJ/bLu9K1i+8GfC+7iEdkXgvNYiKuzTL9+KL/AHf71KK5dzrpUW9WfGeueKNY17ULi8vbyeeS7leVpWfdud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QAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUE3CgLsbu9qB2Dd7UBYMj0pWGHHpRYB1FibsKLBcKZQUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAf//Z" id="yyye" width="271" height="329"/>
</div>
<script>
function aaaaa() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var img = document.getElementById('yyye');
ctx.drawImage(img, 0, 0);
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
var datanew=array();
for(var i0=0; i0<imgData.data.length/4; i0++) {
datanew[]=array();
}
var data0=array();
for(var i0=0; i0<imgData.data.length; i0=i0+4) {
data0[]=array(imgData[i0],imgData[i0+1],imgData[i0+2],imgData[i0+3]);
}
var a1=Math.round(Math.random()*255);
var a2=Math.round(Math.random()*255);
var a3=Math.round(Math.random()*255);
var a4=Math.round(Math.random()*255);
datanew[0][]=a1;
datanew[0][]=a2;
datanew[0][]=a3;
datanew[0][]=a4;
var i001=0;
while(true) {
i001++;
var exit=true;
for(var i0=0; i0<datanew.length; i0++) {
if(datanew[i0].length==0){
exit=false;
}
}
if(exit==true) break;
if(datanew[i001].length>0) continue;
var d=Math.sqrt((data0[i001][0]*data0[i001-1][0]+data0[i001][1]*data0[i001-1][1]+
data0[i001][2]*data0[i001-1][2]+data0[i001][3]*data0[i001-1][3])/4);
var distancefound=false;
while(distancefound==false) {
a1=Math.round(Math.random()*255);
a2=Math.round(Math.random()*255);
a3=Math.round(Math.random()*255);
a4=Math.round(Math.random()*255);
datanew[i001][0]=a1;
datanew[i001][1]=a2;
datanew[i001][2]=a3;
datanew[i001][3]=a4;
var d1=Math.sqrt((datanew[i001][0]*datanew[i001-1][0]+datanew[i001][1]*datanew[i001-1][1]+
datanew[i001][2]*datanew[i001-1][2]+datanew[i001][3]*datanew[i001-1][3])/4);
if(d1-d2<10) distancefound=true;
if(distancefound==true) {
for(var i0=0; i0<data0.length; i0++) {
if(data0[i0][0]=data0[i001-1][0]&&data0[i0][1]=data0[i001-1][1]&&
data0[i0][2]=data0[i001-1][2]&&data0[i0][3]=data0[i001-1][3]){
newdata[i0][0]=a1;
newdata0[i0][1]=a2;
newdata0[i0][2]=a3;
newdata0[i0][3]=a4;
}
}
}
}
i001++;
}
for (i = 0; i < imgData.data.length; i += 4) {
imgData.data[i] = datanew[i][0];
imgData.data[i + 1] = datanew[i][1];
imgData.data[i + 2] = datanew[i][2];
imgData.data[i + 3] = datanew[i][3];
}
ctx.putImageData(imgData, 0, 0);
}
aaaaa();
</script>
</body>
</html>
Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-24 10:53 -0800 |
| Message-ID | <65c905c2-6284-4ef0-a7fb-0a407c5839dan@googlegroups.com> |
| In reply to | #39320 |
I have been playng around with this code now:
<html>
<body>
<canvas id="canvas" width="555" height="555"></canvas>
<p></p>
<div style="display:none;">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAEYARgDAREAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9U6ACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKAEbpUTAF6UQAWrAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgBG6VEwBelEAFqwCgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoARulRMAX7oogAtNgFIAqwCpbAbx607gJuAouA1p0X7/y/wC9RcdmCzo/3PmouFmPyDRcQYHrRcB1MAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAo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FAHNePoPtXhe6h3yrvaL/VNtb761Ei6W55nD4Zs0beyea3+181c8jokaFvodmn3IVX/gFWIvR6HZ7f9Sv/AHzQA6Tw5Z/88VX/AIDQMjk8Pui74JmVv9mgCH7Lqtq332ZaALFvfpu2X9s3/fFAG9pc+jtu2XLRNTuS0dBHbv8A8u95u/4FRcyaLSrMn3nrQzLEe7b81AD6sAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoAKACgAoArXllbahbtbXcYkjfquamwGevhXQ1+7Zf+RGosBKvh3R16Wf/j7UWK5h66Hpafdtf/HmosHMO/sbT/8An3/WixXtQ/siw/54D86LB7QG0fTm+9bp+ZqLB7Qik8PaRL/rLNT/AMDb/Giwe0ZEPCuh7t62I/7+NRYnmJ4dC0y3/wBVAy/9tWosK5cjgWL7u7/vqtRE1ABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUE3CgLsbu9qB2Dd7UBYMj0pWGHHpRYB1FibsKLBcKZQUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAFABQAUAf//Z" id="yyye" width="271" height="329"/>
</div>
<script>
function aaaaa() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var img = document.getElementById('yyye');
ctx.drawImage(img, 0, 0);
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
var datanew=new Array();
for(var i0=0; i0<imgData.data.length/4; i0++) {
datanew.push(new Array());
}
var data0=new Array();
for(var i0=0; i0<imgData.data.length; i0=i0+4) {
data0.push(new Array(imgData.data[i0],imgData.data[i0+1],0,0));
}
var a1=Math.round(Math.random()*255);
var a2=Math.round(Math.random()*255);
var a3=0;
var a4=0;
datanew[0].push(a1);
datanew[0].push(a2);
datanew[0].push(a3);
datanew[0].push(a4);
var i001=0;
var iiiii0=0;
while(true) {
iiiii0++;
if(iiiii0>555) break;
i001++;
/*
var exit=true;
for(var i0=0; i0<datanew.length; i0++) {
if(datanew[i0].length==0){
exit=false;
console.log("fff");
}
}
if(exit==true) break;
*/
console.log(data0[i001]);
console.log(data0[i001-1]);
var d=Math.sqrt(((data0[i001][0]-data0[i001-1][0])*(data0[i001][0]-data0[i001-1][0])+(data0[i001][1]-data0[i001-1][1])*(data0[i001][1]-data0[i001-1][1])+
(data0[i001][2]-data0[i001-1][2])*(data0[i001][2]-data0[i001-1][2])+(data0[i001][3]-data0[i001-1][3])*(data0[i001][3]-data0[i001-1][3]))/4);
var distancefound=false;
while(distancefound==false) {
for(var j1=0;j1<255;j1++) {
if(distancefound) continue;
for(var j2=0;j2<255;j2++) {
if(distancefound) continue;
for(var j3=0;j3<2;j3++) {
if(distancefound) continue;
a1=j1;
a2=j2;
a3=0;
a4=0;
datanew[i001][0]=a1;
datanew[i001][1]=a2;
datanew[i001][2]=a3;
datanew[i001][3]=a4;
var d1=Math.sqrt(((datanew[i001][0]-datanew[i001-1][0])*(datanew[i001][0]-datanew[i001-1][0])+(datanew[i001][1]-datanew[i001-1][1])*(datanew[i001][1]-datanew[i001-1][1])+
(datanew[i001][2]-datanew[i001-1][2])*(datanew[i001][2]-datanew[i001-1][2])+(datanew[i001][3]-datanew[i001-1][3])*(datanew[i001][3]-datanew[i001-1][3]))/4);
if((Math.abs(d1-d)>0)&&(Math.abs(d1-d)<10)) distancefound=true;
console.log(d+" "+d1);
if(distancefound==true) {
console.log("distancef");
/*
for(var i0=0; i0<data0.length; i0++) {
if(data0[i0][0]==data0[i001-1][0]&&data0[i0][1]==data0[i001-1][1]&&
data0[i0][2]==data0[i001-1][2]&&data0[i0][3]==data0[i001-1][3]){
datanew[i0][0]=a1;
datanew[i0][1]=a2;
datanew[i0][2]=a3;
datanew[i0][3]=a4;
}
}
*/
}
}
}
}
}
i001++;
}
console.log("end");
/*
for (i = 0; i < imgData.data.length; i += 4) {
imgData.data[i] = datanew[i][0];
imgData.data[i + 1] = datanew[i][1];
imgData.data[i + 2] = datanew[i][2];
imgData.data[i + 3] = datanew[i][3];
}
ctx.putImageData(imgData, 0, 0);
*/
}
aaaaa();
</script>
</body>
</html>
Please help me, if you can.
Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2020-12-25 09:33 -0800 |
| Message-ID | <ba211fe3-61b9-48f8-bdf9-a3a95701d16bn@googlegroups.com> |
| In reply to | #39325 |
On Thursday, December 24, 2020 at 12:53:56 PM UTC-6, jippii...@gmail.com wrote: > I have been playng around with this code now: > > [...] > > Please help me, if you can. Do you want to just apply a filter to an image? <https://www.html5rocks.com/en/tutorials/canvas/imagefilters/>
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <iiiiiiiiiiiia@bestmail.us> |
|---|---|
| Date | 2020-12-25 23:17 -0800 |
| Message-ID | <66f01bbe-60e1-4b57-bbbf-708171a5c541n@googlegroups.com> |
| In reply to | #39328 |
Michael Haufe (TNO) kirjutas reede, 25. detsember 2020 kl 19:34:02 UTC+2: > On Thursday, December 24, 2020 at 12:53:56 PM UTC-6, jippii...@gmail.com wrote: > > I have been playng around with this code now: > > > > [...] > > > > Please help me, if you can. > Do you want to just apply a filter to an image? > > <https://www.html5rocks.com/en/tutorials/canvas/imagefilters/> That is a good idea, but I would like this code to work, but it seems to be too slow. Probably because of it is programmed not very optimally. With smaller images it would run faster I believe. Kristjan
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <iiiiiiiiiiiia@bestmail.us> |
|---|---|
| Date | 2020-12-25 23:18 -0800 |
| Message-ID | <c8d1fd22-87d0-4e02-9726-d35232478574n@googlegroups.com> |
| In reply to | #39333 |
Kristjan Robam kirjutas laupäev, 26. detsember 2020 kl 09:17:11 UTC+2: > Michael Haufe (TNO) kirjutas reede, 25. detsember 2020 kl 19:34:02 UTC+2: > > On Thursday, December 24, 2020 at 12:53:56 PM UTC-6, jippii...@gmail.com wrote: > > > I have been playng around with this code now: > > > > > > [...] > > > > > > Please help me, if you can. > > Do you want to just apply a filter to an image? > > > > <https://www.html5rocks.com/en/tutorials/canvas/imagefilters/> > That is a good idea, but I would like this code to work, but it seems to be too slow. Probably because of > it is programmed not very optimally. > With smaller images it would run faster I believe. > > > > Kristjan I hope Bill Gates could help me, because he's probably more competent in programming languages than me. Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <iiiiiiiiiiiia@bestmail.us> |
|---|---|
| Date | 2020-12-25 23:33 -0800 |
| Message-ID | <0b7820cd-0efe-4299-99b1-257b97c206c2n@googlegroups.com> |
| In reply to | #39333 |
Michael, I believe You understand, what I am trying to do ? I deleted some of the code from beginning, where it checks if a color is already assigned to a pixel, to make it first more simple. Because it loaded too slowly. Kristjan Robam
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2020-12-26 08:30 -0800 |
| Message-ID | <af03207f-93b3-47d1-b2ba-e2ef6dfb5bean@googlegroups.com> |
| In reply to | #39333 |
On Saturday, December 26, 2020 at 1:17:11 AM UTC-6, Kristjan Robam wrote: > Michael Haufe (TNO) kirjutas reede, 25. detsember 2020 kl 19:34:02 UTC+2: > > On Thursday, December 24, 2020 at 12:53:56 PM UTC-6, jippii...@gmail.com wrote: > > > I have been playng around with this code now: > > > > > > [...] > > > > > > Please help me, if you can. > > Do you want to just apply a filter to an image? > > > > <https://www.html5rocks.com/en/tutorials/canvas/imagefilters/> > That is a good idea, but I would like this code to work, but it seems to be too slow. Probably because of > it is programmed not very optimally. > With smaller images it would run faster I believe. > I'd suggest getting it to work even if it's slow. After that we could potentially look into optimization..
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <jippii1291983@gmail.com> |
|---|---|
| Date | 2020-12-27 07:57 -0800 |
| Message-ID | <ec53d061-6cdd-4ec8-956e-2b2a13952d8an@googlegroups.com> |
| In reply to | #39336 |
Michael Haufe (TNO) kirjutas laupäev, 26. detsember 2020 kl 18:30:27 UTC+2: > On Saturday, December 26, 2020 at 1:17:11 AM UTC-6, Kristjan Robam wrote: > > Michael Haufe (TNO) kirjutas reede, 25. detsember 2020 kl 19:34:02 UTC+2: > > > On Thursday, December 24, 2020 at 12:53:56 PM UTC-6, jippii...@gmail.com wrote: > > > > I have been playng around with this code now: > > > > > > > > [...] > > > > > > > > Please help me, if you can. > > > Do you want to just apply a filter to an image? > > > > > > <https://www.html5rocks.com/en/tutorials/canvas/imagefilters/> > > That is a good idea, but I would like this code to work, but it seems to be too slow. Probably because of > > it is programmed not very optimally. > > With smaller images it would run faster I believe. > > > I'd suggest getting it to work even if it's slow. After that we could potentially look into optimization.. Yes. But I am so lazy, that I don't want to waste my time and am posting this for doing for You, guys....... ;) Kristjan
[toc] | [prev] | [next] | [standalone]
| From | I A <he12457@hotmail.com> |
|---|---|
| Date | 2021-02-14 09:24 -0800 |
| Subject | If somebody reads this again ..... |
| Message-ID | <c5816ea2-4f90-46be-9bbd-592733810cdbn@googlegroups.com> |
| In reply to | #39339 |
What I actually wanted to say was: I need a code, that creates a random color x for pixel y and makes a new picture, that has all new pixels with same r,g,b distance as color x and pixel y color distance. Basically New point (X1R,X1G,X1B) is ((randomcR-x0R+x1R)%255; (randomcG-x0G+x1G)%255; (randomcB-x0B+x1B)%255). He (Tema) E-mail: he4124135 mail co m Telephone number: 372 6861327
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web