Giter VIP home page Giter VIP logo

Comments (6)

jcupitt avatar jcupitt commented on June 19, 2024

Yes, global balance will work on merged images too.

You might need to run it in sections, so balance 10x10 blocks of tiles, then balance again after final assembly.

from pyvips.

shivamchaubey avatar shivamchaubey commented on June 19, 2024

Can you give please an example to integrate this with merge function?
My code looks like.

1. def stitch(coor):
2.     global onlyfiles,mypath,row,column
3.     onlyfiles=np.array(onlyfiles)
4.     files=onlyfiles.reshape(row,column)
5.     blend=False
6.     for r in tqdm(range(files.shape[0])):    
7.         c=0
8.         if r==0:
9.             tile = pyvips.Image.black(coor[r,c][0],coor[r,c][1])
10.         else:
11.             tile = pyvips.Image.black(coor[r,c][0],coor[r,c][1]-coor[r-1,c][1])        
12.         for c in tqdm(range(files.shape[1])): 
13.             tile1 = pyvips.Image.new_from_file(join(mypath,files[r][c]), access="sequential")
14.             if r==0:
15.                 x,y=coor[r,c]
16.             else:
17.                 x,y=coor[r,c][0],coor[r,c][1]-coor[r-1,0][1]
18.             tile = tile.merge(tile1, 'horizontal', -x, -y, mblend =blend)
19.         if r>0:
20.             y=coor[r-1,0][1]
21.             stitch_img = stitch_img.merge(tile, 'vertical', 0, -y, mblend =blend)    
22.         else :
23.             stitch_img=tile
24.     print (stitch_img.width,stitch_img.height,"width","height")        
25.     stitch_img.dzsave('test_80X80')

I have tried inserting tile=tile.globalbalance() at line number 19 for adjacent contrast adjustment , and also stitch_img=stitch_img.globalbalance() at line number 22 for contrast adjustment between each row. It's not working and I am getting an error.

Error:

raise Error('unable to call {0}'.format(operation_name))
pyvips.error.Error: unable to call globalbalance
im_global_balance: unable to open "temp-0"

Please provide an example for this function.

from pyvips.

jcupitt avatar jcupitt commented on June 19, 2024

Don't use black, it'll get confused.

You need to start from a set of images on disc, merge them together, then call globalbalance.

from pyvips.

shivamchaubey avatar shivamchaubey commented on June 19, 2024

How those black pixels can be ignored. I have added 255 value to those pixels but it's not working with global balance. I can't remove those black pixel area, however, I can modify them to work for global balance. What kind of modification is needed for global balance?

from pyvips.

jcupitt avatar jcupitt commented on June 19, 2024

You don't need black to assemble a mosaic, do you? Build it without using black and globalbalance should work.

from pyvips.

shivamchaubey avatar shivamchaubey commented on June 19, 2024

Whenever I am using merge function, I will have some black pixels because my image is shifting in vertical direction also. So, an extra region is padded with a black pixel. I was using a black image for the first merging operation to make coordinates easy otherwise I have to make dynamic coordinates for merging operation, which is related to the input frame of reference.

from pyvips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.