Jump to content
Sign in to follow this  
kjjj11223344

resample.exe mask help

Recommended Posts

I forked ortho4xp on github to try to modify it to support fsx/p3d. It is working, but I am stuck in trying to utilize the masks generated by ortho4xp for creating blend masks with resample.exe Long story short, ortho4xp generates a mask bmp at zoom level 14 which comprises the area in question. No matter what I do, the produced bgl isn't masked properly. Areas that should be masked aren't, and areas that shouldn't are.

 

I know the lat and longs and cellxdimension, cellydimension values in the inf files are correct, because I have generated bgl's utilizing only the satellite photo as the source and a bgl utilizing only the mask photo as the source (as layer type Imagery so it shows up in the sim), and they both line up in tmfviewer in the area of the satellite photo which the mask encompasses (as the mask encompasses a smaller area than the satellite photo).... I am really not sure what is going wrong, I have tried everything, and would really appreciate some help.

Do masks of bmp's need to be the same dimensions and lat and long as the bmp they mask? I have tried to use tiffs as masks, and it makes no difference. The only time it worked is when I forced ortho4xp to generate a mask which produced a mask image of the same dimensions and top left lat/lon as the satellite bmp. However, it isn't feasible to do this for high zoom levels because one quickly runs out of memory due to how ortho4xp generates the mask files.

 

Below is an example of an inf file (I can upload the satellite bmp and mask bmp to google drive if needed):

 

[Source]
Type = MultiSource
NumberOfSources = 2

[Source1]
Type          = BMP
Layer          = Imagery
SourceDir  = F:\ortho4xpvm\Ortho4XP_FSX_P3D\Orthophotos\+25-081\USA_2_11
SourceFile = 864_560_USA_211.bmp
Lon               = -81.5625
Lat               = 27.05912578437406
NumOfCellsPerLine = 4096       ;Pixel isn't FSX/P3D
NumOfLines        = 4096       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 0.0006866455078125
CellYdimensionDeg = 0.000618161855902407
PixelIsPoint      = 0
SamplingMethod    = Point
; pull the blend mask from Source2, band 0
Channel_BlendMask = 2.0

[Source2]
Type          = BMP
Layer          = None
SourceDir  = F:\ortho4xpvm\Ortho4XP_FSX_P3D\Masks\+25-081
SourceFile = whole_tile.bmp
Lon               = -81.2109375
Lat               = 26.115985925333533
NumOfCellsPerLine = 16384       ;Pixel isn't FSX/P3D
NumOfLines        = 16384       ;Pixel isn't used in FSX/P3D
CellXdimensionDeg = 8.58306884765625e-05
CellYdimensionDeg = 7.747928327110458e-05
PixelIsPoint      = 0
SamplingMethod    = Point

[Destination]
DestDir             = F:\ortho4xpvm\Ortho4XP_FSX_P3D\Orthophotos\+25-081\USA_2_11\ADDON_SCENERY\scenery
DestBaseFileName     = 864_560_USA_211
BuildSeasons        = 0
UseSourceDimensions  = 1
CompressionQuality   = 100
LOD = Auto,13
 


Boeing777_Banner_Pilot.jpgsig_TheBusIveBeenWaitingFor.jpg

Alfredo Terrero

Share this post


Link to post
Share on other sites

Hello Panos,

I will check out your example. However, I have created TIFFS from the satellite photo by hand using GIMP to test, and it still doesn't work. What happens is that the mask and the base imagery is completely unaligned, producing very weird behavior. The only time that it worked is when I had the mask file be the same dimensions and cover the same geopgraphic area as the satellite imagery bmp (in fact, In this case the mask file was bmp and it still worked). I am going to upload my satellite imagery to a cloud provider, maybe there is something wrong with my images.

When I tried with TIFF, I saved both with and without LZW compression,and still had the same problems.


Boeing777_Banner_Pilot.jpgsig_TheBusIveBeenWaitingFor.jpg

Alfredo Terrero

Share this post


Link to post
Share on other sites

I tried your tiff. I rescaled it to 16384 x 16384 pixels as the tiffs I need to use are. I set the top left lat and Lon to that of the tiff I need to use as well. The same problem occurred as with my tiffs/bmps. I see some resampling occurring, but the same thing occurs as with The tiffs and bmps I was originally using(ie the mask doesn’t seem to scale nicely on top of the smaller satellite image). The satellite base image is 4096x4096 pixels, and it is as if the first 4096x4096 pixels of the mask tiff are used when resampling.

 

i am not sure why. Maybe I’m misunderstanding how resample works, but I set cellXDimensionDegrees and cellYDimensionDegrees of the mask to be 1/4th that of the values I use for the satellite image. Is this not correct? The mask tiff is 4 times the size in terms of width and 4 times in terms of height, so shouldn’t each pixel represent an increment 1/4th that of the increment in the base satellite bmp?


Boeing777_Banner_Pilot.jpgsig_TheBusIveBeenWaitingFor.jpg

Alfredo Terrero

Share this post


Link to post
Share on other sites

I gave up and switched to Ortho4XP v1.30 which generates masks for each downloaded satellite bmp at the correct zoom level instead of one large mask for the area at zoom level of 14. It is working fine now. I think the issue is that resample.exe needs the mask and the main image that is to be masked to cover the same physical geographic area.


Boeing777_Banner_Pilot.jpgsig_TheBusIveBeenWaitingFor.jpg

Alfredo Terrero

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...