You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, September 5th 2009, 7:03pm

Masking with 2 images and an alpha mask image, is it posble ?

Hi.

When I saw the "Masks" example of krpano 1.0.7 (http://krpano.com/examples/masks/), I think that it used 3 images:
1 - the original image
2 - a modified image, with xray effect aplicated for example
3 - the mask image, a B&W image that indicates what you can see trough, black hide the image, white show the image, like the Photoshop masks

But don´t work like that. Only are 2 images, the original image and a mask image. Krpano apply the selected effect to te original image in the mask zone.

I want to do masking like the first way I write, 2 images (original in color and B&W for example) and a mask image that let see through.

Can I do this ?

Sorry about my english *unsure*

bulp

Intermediate

Posts: 389

Location: Malaysia

  • Send private message

2

Sunday, September 6th 2009, 2:50pm

hye lorth2... try download krpano version 1.0.8 beta8 and examine the masked-radar-textfield-hotspot example... krpano have parentchild..

3

Sunday, September 6th 2009, 5:52pm

hye lorth2... try download krpano version 1.0.8 beta8 and examine the masked-radar-textfield-hotspot example... krpano have parentchild..
THX bulp. I need something similar, but not that.

I need the combination of http://krpano.com/examples/108b8/example…tspot/mask.html and this http://krpano.com/examples/masks/

4

Tuesday, September 8th 2009, 11:28am

Hi,

what do you what to do?
what is the "modified image" in your listing?

best regards,
Klaus

5

Wednesday, September 9th 2009, 6:10pm

I need something like this

You can see trough a hole (mask) antoher image modified by photoshop

Is a combination of http://krpano.com/examples/108b8/example…tspot/mask.html and http://krpano.com/examples/masks/



Can I do this ? ;-)


michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

6

Wednesday, September 9th 2009, 10:04pm

Hi lorth2,

I think you will retrieve something interesting in the following thread:
Example/Tutorial - interactive area in the pano (aligned distorted hotspot)

Hope this can help.

Salut.

7

Thursday, September 10th 2009, 12:08am

THX Michel, but I don´t want this effect.

I want the mask always in the middle of the screen, like the Xray effect in http://krpano.com/examples/masks/ . But instead of apply the xray effect to the background image, I want the image you see behind be another image different, like this http://krpano.com/examples/108b8/example…tspot/mask.html the mountain image is masked, but in the example, the mountain image and the mask moves with the background image.

Sorry, my english is poor, I can´t emplain

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

8

Thursday, September 10th 2009, 2:37am

Hi lorth22,

After many tries... I got this code that looks to do what you are looking for:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
	<!-- Plugin image -- for your first image -->
	<plugin name="pic1" url="image1.jpg"
			visible="true"
			enabled="true"
			capture="false"
	    	align="center"
	    	x="0"
	    	y="0"
	    	onover="set(plugin[pic2].visible,true);"
			onout="set(plugin[pic2].visible,false);"
	    	/>
			
	<!-- masked Plugin image -- for your second image -->
	<plugin name="pic2" url="image2.jpg"
			visible="false"
			enabled="false"
			capture="false"
	    	align="center"
	    	x="0"
	    	y="0"
	    	mask="plugin[picmask]"
	    	/>
			
	<!-- the mask Plugin image -->		
	<plugin name="picmask" url="image_mask.png"
			enabled="false"
			capture="false"
	    	align="center"
	    	x="0"
	    	y="0"
	    	/>


The plugin[pic1] listens to onover and onout mouse action to make plugin[pic2].visible true or false...
I hope this can help.

Salut.

9

Thursday, September 10th 2009, 10:15am

Hi,

yes, that's possible and very easy

I have prepared here an example:
HTML: http://krpano.com/examples/maskedhotspot/index.html
XML: http://krpano.com/examples/maskedhotspot/maskedhotspot.xml

the "modified" part of the pano must be placed as distorted hotspot in pano,
like here:
Example/Tutorial - interactive area in the pano (aligned distorted hotspot)

then the mask image must be included as <plugin> (note this image must have an alpha mask!)
e.g.

Source code

1
2
3
4
5
6
7
<plugin name="spotmask"
        url="spotmask.png"
        align="center"
        enabled="false"
        height="40%"
        width="prop"
        />


and then the "mask" from the hotspot must be set to the mask plugin image,
e.g.

Source code

1
2
3
4
<hotspot name=".."
         ...
         mask="plugin[spotmask]"
         />


that's all

(if you can provide your images I can make the example with them)

best regards,
Klaus

10

Friday, September 11th 2009, 8:24pm

<spanOx")'"> Unbelievable Klaus !!!

I think this is what I was searching.
Tomorrow I´ll try it, and post results.

THX

11

Friday, September 11th 2009, 8:26pm

Hi lorth22,

After many tries... I got this code that looks to do what you are looking for:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
	<!-- Plugin image -- for your first image -->
	<plugin name="pic1" url="image1.jpg"
			visible="true"
			enabled="true"
			capture="false"
	    	align="center"
	    	x="0"
	    	y="0"
	    	onover="set(plugin[pic2].visible,true);"
			onout="set(plugin[pic2].visible,false);"
	    	/>
			
	<!-- masked Plugin image -- for your second image -->
	<plugin name="pic2" url="image2.jpg"
			visible="false"
			enabled="false"
			capture="false"
	    	align="center"
	    	x="0"
	    	y="0"
	    	mask="plugin[picmask]"
	    	/>
			
	<!-- the mask Plugin image -->		
	<plugin name="picmask" url="image_mask.png"
			enabled="false"
			capture="false"
	    	align="center"
	    	x="0"
	    	y="0"
	    	/>


The plugin[pic1] listens to onover and onout mouse action to make plugin[pic2].visible true or false...
I hope this can help.

Salut.
I´ll try it tomorrow.
Reading the code seems to be I was looking for.

THX *thumbsup* THX THX THX

12

Saturday, September 12th 2009, 6:33pm

Hi Klaus



You ask me for the images I want to use.



http://img17.imageshack.us/img17/7056/cave1d.jpg

http://img36.imageshack.us/img36/9549/cave2.jpg



This is for an investigation program. I want to draw the wall paintings
with Photoshop and watch the drawings <spanOx")'">through the
mask.

THX *thumbsup*

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

13

Sunday, September 13th 2009, 7:21pm

Hi KLAUS,

I have noticed something strange on the "maskedhostspot" example .... *confused*

Open your example http://krpano.com/examples/maskedhotspot/index.html , zoom out a little to make more visible the mistake, then pan left or right... when you arrive between 65º (depending of the FOV) the "maskedhostspot" seems to "loose his mask" and becomes visible *attention*

This happens only with Flash 10... If you toggle to Flash 9, this does not Happen....

Salut.

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

14

Monday, September 14th 2009, 5:12am

Hi KLAUS,

After more tries, I have noticed that, the mistake described above does not happens using fisheye view instead of normal view *attention*
In the example below, using the context menu, you can switch between fisheye view and normal view to view what it is happening.
I also noticed that distorted hospot does not apply correctly on Pannini projection...


Hi lorth,

I have made an example using your image cave1d.jpg as the Pano, a cropped image from your first uploaded image (image1 + image2 + mask = result) as the distorted hospot and the spotmask.png from the example made by Klaus (the car). I have proceeded as Klaus explain.
Here is the result : http://andorra360.com/test/ForumKrpano/lorth22/

Salut.

15

Monday, September 14th 2009, 10:47pm

Hi,
You ask me for the images I want to use.
thanks great!

I have noticed something strange on the "maskedhostspot" example .... *confused*

Open your example http://krpano.com/examples/maskedhotspot/index.html , zoom out a little to make more visible the mistake, then pan left or right... when you arrive between 65º (depending of the FOV) the "maskedhostspot" seems to "loose his mask" and becomes visible *attention*
I already know this problem,
it's a bad flash behavior, when using a masks (or filter, e.g. sharpen in the HIGHSHARP mode),
in this case Flash converts the underlaying object (the pano in this case) to an internally bitmap and then applies the mask (or the filter) on it,
but Flash has a limit of 2880x2880 pixel for bitmaps, and if the object reaches this limit it will just NOT apply the mask (or the filter),

now - why does it reach this limit of 2880 pixels, when using Flash10 (and no fisheye distortion), then there were very large triangles used (see them by pressing TAB), there are clipping offscreen of course, but Flash counts the "real" size for converting to bitmap,

I know to solve this problem by manually clipping, but I still need to implement it,
I also noticed that distorted hospot does not apply correctly on Pannini projection...
yes, right, pannini projection can't be used for hotspots,
hotspots can change dynamically (size, position, rotation) and that would require re-calculating of the pannini projection after every change and that would be too slow for sense full usage...


I have made an example using your image cave1d.jpg as the Pano, a cropped image from your first uploaded image (image1 + image2 + mask = result) as the distorted hospot and the spotmask.png from the example made by Klaus (the car). I have proceeded as Klaus explain.
Here is the result : http://andorra360.com/test/ForumKrpano/lorth22/
wow, great example!


best regards,
Klaus

16

Wednesday, September 16th 2009, 10:21am

Hi Klaus and Michel

I tried the solutions you give to me. But I can´t do work it.
In the Klaus solution, the image1.jpg don´t move.
In the Michel solution the modified image stay apears, but the mask don´t work.

*cry*

I think the Klaus solution is what I was looking for, but can´t make it works.
Can you make the example using the images I upload ?

http://img17.imageshack.us/img17/7056/cave1d.jpg



http://img36.imageshack.us/img36/9549/cave2.jpg

I think I have a mistake in the code, but I can,t find it.

The Michel example works fine, but when I try to make the same don´t work.

17

Wednesday, September 16th 2009, 8:00pm

Hi Michel.
You maked a example at : http://andorra360.com/test/ForumKrpano/lorth22/

I have make it works, but I don´t know how can you calculate the following variables:

width="608.040201" height="475.502512" edge="leftop" ox="-181.532663" oy="-500"

How do you know it for be in the correct place ?
THX

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

18

Thursday, September 17th 2009, 2:05am

Hi lorth22,

Quoted

How do you know it for be in the correct place ?
  • use cube faces

  • the changing area should be in one cube face

  • crop out the modified/different area out

  • important - note the position and size of the cropped area

  • then calculate the position and size for the hotspot:
    • some explanations first:
      • the internal space in krpano for distorted hotspots is 1000x1000
      • that means a hotspot with a size of 1000x1000 covers the same area like a cube face

    • now with the noted sizes about the cropped area the position and size of the hotspot can be calculated:
      • hotspot.width = area-width * 1000 / original-cubeface-width
      • hotspot.height = area-height * 1000 / original-cubeface-height
      • hotspot.ox = area-x * 1000 / original-cubeface-width - 500
      • hotspot.oy = area-y * 1000 / original-cubeface-height - 500
      • the "hotspot.edge" must be set to "lefttop" for these calculations

    • finally the ath/atv position of the hotspot must be set to move the hotspot to the correct cube face:
      here are the positions for the cube sides:
      • front: ath="0" atv="0"
      • right: ath="90" atv="0"
      • left: ath="-90" atv="0"
      • back: ath="180" atv="0"
      • up: ath="0" atv="-90"
      • down: ath="0" atv="+90"

You can found a detailed explaination from KLAUS example below:
Example/Tutorial - interactive area in the pano (aligned distorted hotspot)
It is well explained (as always klaus do *thumbsup*... THE MASTER *rolleyes* )

I am making a new example using your second image too ( cave2.jpg ).
Many problems here *blink* *wacko* *confused* *cursing* *angry* *huh* *unsure* *cry* *whistling* *squint* *g*

When I get it, I will post. ;-)

Salut.

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

19

Thursday, September 17th 2009, 3:59am

Hi lorth22,

Here is the second example: http://andorra360.com/test/ForumKrpano/lorth22/index2.html

I have used:
Finally, I have added buttons to switch each hotspot ON / OFF and buttons to enable/disable a mask for each hotspot. With those buttons you can play around to see what is happening in different configurations. *smile* Also, there is the context menu for switching between different projections.

For example:
Try to enable all the cubes and the gravures button... You will notice that the pano goes really slow....
Now, try to disable all the mask buttons of each cube... Now, the pano goes much better (It seems that masked hotspot takes a lot of CPU *sleeping* )




Hi KLAUS,

Doing the example above, I have noticed a few things: *rolleyes*
  • It seems that each distorted hotspot needs to have his own mask. *attention* even if the mask is the same mask for each hotspot. I have tried to mask each hotspots with the same plugin as mask but it does not work. ( in the example above I use the same mask file for each hotspot )
  • It seems that, when fisheye is used, distorted hotspots are not "well distorted"as they are when normal projection is used. *attention* You can notice this yourself on the example above: enable a cube button and disable his mask, then switch between normal view and fisheye view... In normal view the cube hotspot match perfectly with the background... In fisheye view the cube hotspot match near perfectly with the background but there is little differences. *wacko*
That's all. ;-)

Salut.

20

Thursday, September 17th 2009, 10:42am

WOW Michel, that what I looking for.
My mistake was using non cubic images, I was using a equirectangular image to do it.
Another cuestion, do you speak spanish ? I saw you are from Andorra. I´m spanish and my english is poor.

I´m going to do my own example and show to you

THX *g*