Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13825 > unrolled thread
| Started by | TDMF HT <tdmfhtyoutube@appletv.cc> |
|---|---|
| First post | 2013-03-13 08:18 +0000 |
| Last post | 2013-03-19 05:51 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Cropping image parts through list of lists TDMF HT <tdmfhtyoutube@appletv.cc> - 2013-03-13 08:18 +0000
Re: Cropping image parts through list of lists Vince Virgilio <blueschi@gmail.com> - 2013-03-19 04:04 +0000
Re: Cropping image parts through list of lists "Barrie Stokes" <Barrie.Stokes@newcastle.edu.au> - 2013-03-19 05:51 +0000
| From | TDMF HT <tdmfhtyoutube@appletv.cc> |
|---|---|
| Date | 2013-03-13 08:18 +0000 |
| Subject | Cropping image parts through list of lists |
| Message-ID | <khpcnr$mdb$1@smc.vnet.net> |
Newbie with OOP way of thinking, so bear with me :) Thank you !
Given - list of lists:
myList = { { {0,100},{50,100},{800,600} } , { {{100,100},{150,100},{1024,768} } }
Using the above list of lists, I want to crop two different parts from a single image an resize the resulting partial image in the following way;
Cropped image 1:
cropXY: 0,100/50,100
resize: 800,600
Cropped image 2:
cropXY: 100,100/150,100
resize: 1024,768
My OOP way of thinking tells me to iterate/loop over the outer and inner lists.
This doesnt seem to be the Mathematica way, so I spent the last couple of hours messing around with
DO/TAKE etc. and all image related functions.
I dont seem to find the right way to sequentially go over the inner lists and crop/resize the two parts from the single image.
Id really appreciate a few tips on how to get this done.
Thanks a bunch !!!!
[toc] | [next] | [standalone]
| From | Vince Virgilio <blueschi@gmail.com> |
|---|---|
| Date | 2013-03-19 04:04 +0000 |
| Message-ID | <ki8o4s$kof$1@smc.vnet.net> |
| In reply to | #13825 |
On Wednesday, March 13, 2013 4:18:03 AM UTC-4, TDMF HT wrote:
> Newbie with OOP way of thinking, so bear with me :) Thank you !
>
>
>
> Given - list of lists:
>
>
>
> myList = { { {0,100},{50,100},{800,600} } , { {{100,100},{150,100},{1024,768} } }
>
>
>
> Using the above list of lists, I want to crop two different parts from a single image an resize the resulting partial image in the following way;
>
>
>
> Cropped image 1:
>
> cropXY: 0,100/50,100
>
> resize: 800,600
>
>
>
> Cropped image 2:
>
> cropXY: 100,100/150,100
>
> resize: 1024,768
>
>
>
> My OOP way of thinking tells me to iterate/loop over the outer and inner lists.
>
> This doesnt seem to be the Mathematica way, so I spent the last couple of hours messing around with
>
> DO/TAKE etc. and all image related functions.
>
>
>
> I dont seem to find the right way to sequentially go over the inner lists and crop/resize the two parts from the single image.
>
> Id really appreciate a few tips on how to get this done.
>
>
>
> Thanks a bunch !!!!
Maybe
newImages = MapThread[ cropFunction, { img1, img2 }, { parm1, parm2 } ];
where
cropFunction[img_, { cropX_, cropY_, resize_}] := Module[{...}, newImage = ...; newImage ];
does the work.
[toc] | [prev] | [next] | [standalone]
| From | "Barrie Stokes" <Barrie.Stokes@newcastle.edu.au> |
|---|---|
| Date | 2013-03-19 05:51 +0000 |
| Message-ID | <ki8ucr$o7b$1@smc.vnet.net> |
| In reply to | #13825 |
How about:
Map[ (s \[Function] Show[ ImageTake[img,
\!\(\*SubscriptBox[\(s\), \(\(\[LeftDoubleBracket]\)\(\ \)\(1\)\(\
\[RightDoubleBracket]\)\)]\),
\!\(\*SubscriptBox[\(s\), \(\(\[LeftDoubleBracket]\)\(\ \)\(2\)\(\
\[RightDoubleBracket]\)\)]\)], ImageSize ->
\!\(\*SubscriptBox[\(s\), \(\(\[LeftDoubleBracket]\)\(\ \)\(3\)\(\
\[RightDoubleBracket]\)\)]\) ]), myList ]
where img has been set to the image in question?
Cheers
Barrie
>>> On 19/03/2013 at 3:06 pm, in message <20130319040601.46FC669D0@smc.vnet.net>,
Vince Virgilio <blueschi@gmail.com> wrote:
> On Wednesday, March 13, 2013 4:18:03 AM UTC-4, TDMF HT wrote:
>> Newbie with OOP way of thinking, so bear with me :) Thank you !
>>
>>
>>
>> Given - list of lists:
>>
>>
>>
>> myList = { { {0,100},{50,100},{800,600} } , {
> {{100,100},{150,100},{1024,768} } }
>>
>>
>>
>> Using the above list of lists, I want to crop two different parts from a
> single image an resize the resulting partial image in the following way;
>>
>>
>>
>> Cropped image 1:
>>
>> cropXY: 0,100/50,100
>>
>> resize: 800,600
>>
>>
>>
>> Cropped image 2:
>>
>> cropXY: 100,100/150,100
>>
>> resize: 1024,768
>>
>>
>>
>> My OOP way of thinking tells me to iterate/loop over the outer and inner
> lists.
>>
>> This doesnt seem to be the Mathematica way, so I spent the last couple of
> hours messing around with
>>
>> DO/TAKE etc. and all image related functions.
>>
>>
>>
>> I dont seem to find the right way to sequentially go over the inner lists
> and crop/resize the two parts from the single image.
>>
>> Id really appreciate a few tips on how to get this done.
>>
>>
>>
>> Thanks a bunch !!!!
>
> Maybe
>
> newImages = MapThread[ cropFunction, { img1, img2 }, { parm1, parm2 }];
>
> where
>
> cropFunction[img_, { cropX_, cropY_, resize_}] := Module[{...}, newImage =
> ...; newImage ];
>
> does the work.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web