Giter Site home page Giter Site logo

x and y coordinates are swapped about bb_binary HOT 3 CLOSED

ktugan avatar ktugan commented on September 24, 2024
x and y coordinates are swapped

from bb_binary.

Comments (3)

ktugan avatar ktugan commented on September 24, 2024

how to:

# copies in a static manner the values of a framecontainer into a new one
def deepcopy_framecontainer(fc, fc2):
    fc2.camId = fc.camId
    
    fc2.init('dataSources', len(fc.dataSources))
    for i, datasource in enumerate(fc.dataSources):
        fc2.dataSources[i] = fc.dataSources[i]
    fc2.fromTimestamp = fc.fromTimestamp
    fc2.hiveId = fc.hiveId
    fc2.id = fc.id
    fc2.toTimestamp = fc.toTimestamp
    
    fc2.init('transformationMatrix', len(fc.transformationMatrix))
    for i, tm in enumerate(fc.transformationMatrix):
        fc2.transformationMatrix[i] = fc.transformationMatrix[i]
    
    fc2.init('frames', len(fc.frames))
    for i, frame in enumerate(fc.frames):
        fc2.frames[i] = fc.frames[i]


from bb_binary import Repository, FrameContainer

repo = Repository('data/1h_09-25-15/')
repo_fixed = Repository('data/1h_09-25-15_fixed2/')

for fname in repo.iter_fnames():
    fc = load_frame_container(fname)
    fc2 = FrameContainer.new_message()
    deepcopy_framecontainer(fc, fc2)
    
    for frame in fc2.frames:
    	for detection in frame.detectionsUnion.detectionsDP:
    		detection.x, detection.y = detection.y, detection.x
    
    repo_fixed.add(fc2)

from bb_binary.

gitmirgut avatar gitmirgut commented on September 24, 2024

If all DetectionDP.xpos and DetectionDP.ypos in the whole repro are swapped, i think it is faster to just change the bb_binary_schema.capnp.
From:

struct DetectionDP {
...
  xpos @1 :UInt16;               # x coordinate of the grid center wrt. the image
  ypos @2 :UInt16;               # y coordinate of the grid center wrt. the image
...
}

To:

struct DetectionDP {
...
  ypos @1 :UInt16;               # x coordinate of the grid center wrt. the image
  xpos @2 :UInt16;               # y coordinate of the grid center wrt. the image
...
}

But then we have to fix the output of DP simultaneous, otherwise we produce multiple inconsistent data, where xpos and ypos are sometimes swapped and sometimes not.

If I am not mistaken, the swap of the coordinates in the DP was happening in bb_pipeline-processing.py at line L107.

positions = peak_local_max(im, min_distance=dist)

peak_local_max returns the row (y-Axis) first and then the column(x-Axis).

from bb_binary.

nebw avatar nebw commented on September 24, 2024

See also BioroboticsLab/bb_pipeline@c8f8942

Thanks for the suggestion @gitmirgut

from bb_binary.

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.