Distortion Correction with Lookup Table

Hello,
I am trying to run an image through lookup tables in order to correct some distortion.
I have two 2D lookup tables "LUTsXnew.raw" and "LUTsYnew.raw" which locate the new (x,y) coordinates that i want to move the pixel intensities from original image "writing_final_D.raw" into the corrected image.
However, Labview takes too much time (12 seconds), if you have some experience with arrays and images can you please have a look at my code and tell me what i am doing wrong?
I am running the same algorithm in C on the same pc and it takes less than 1second.
Thanks,
CK
PS: I am attaching the VI plus the required raw images
       Please ignore the resulting image, i just care about speed for the moment
Attachments:
images1.zip ‏287 KB
distortion correction_set pixel1.vi ‏81 KB

CK,
I cannot run your VI because Vision is not supported on my platform. So my comments are general rather than specific.
1. Your while loops can be replaced with for loops because you know the number of iterations in advance.
2. If you transpose the arrays before entering the loops, you can use autoindexing rather than using Index array in the inner loop.
3. If you only update the inner and outer iteration count indicators every 100 iterations you will not have displays that are meaningless to the user using up processor time. Eliminate them completely for the fastest performance.
4. Avoid coercion inside the loops. The IMAQ Set Pixel Value function has coercion dots on three inputs. Doing explicit conversions outside the loops may be faster.
5. The Tick Count functions should be in frames of their own to assure accurate timing.
6. Local variables are not needed and are generally slower than wires.
Lynn
Attachments:
distortion correction_set pixel1.2.vi ‏69 KB

Similar Messages

  • How does CRC 16 with lookup table work?

    I have been try to get CRC16 with a lookup table to work but it does not match the CRC for a device I am trying to simulate.  I have attached the code any help would be great.
    Attachments:
    Binary to Hex String.vi ‏37 KB

    You can't just say you need a CRC-16.  There are way too many parameters involved: Polynomial, Initial CRC, Data Inversion.
    When it comes to a CRC with a lookup table, it uses precalculated results based on a specific CRC implementation.  If you don't know which implementation it uses, it isn't really usable.
    What instrument are you trying to simulate?  What is the exact CRC implementation does it use?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Problem with lookup-table and single quotes

    SOA Suite 10.1.3.3. I have an ESB project with an XSLT map that uses orcl:lookup-table to translate values. I use this instead of lookup-dvm because I want non-IT users to manage the mappings without having access to the ESB Console.
    According to the doco:-
    G.1.79 lookup-table
    orcl:lookup-table(table, inputColumn, key, outputColumn, datasource)
    This function returns a string based on the SQL query generated from the parameters.
    The string is obtained by executing:
    SELECT outputColumn FROM table WHERE inputColumn = key
    The problem I'm having is that it seems if "key" contains a single quote (i.e an apostrophe), then lookup-table fails to find the corresponding value - even though the value in table.inputColumn also contains the single quote.
    I've put the incoming into an XSL variable, but to no avail.
    <xsl:variable name="incoming">
    <xsl:value-of select="/obj1:DEV_MESSAGE_TYP/DATA1"/>
    </xsl:variable>
    <xsl:variable name="dvm-text">
    <xsl:value-of select="orcl:lookup-table('MYTABLE','INVAL',$incoming,'OUTVAL','ds/dev')"/>
    </xsl:variable>
    Are there any XSLT Gurus out there that have come across this or can think of ways around it?
    Thanks in advance...
    Regards,
    Greg

    Ok - the above was on the right track but wasn't 100% because it can't handle more than 1 single quote (apostrophe) in the input to lookup-table.
    I've since found a better solution - an XSLT re-usable template that operates recursively and so can replace multiple occurances of single quotes. I've modified it to handle a null input value, otherwise lookup-table will just return the value of the first row in the lookup table - doh! The way I've done it below, if null is passed in, then null will be returned.
    This goes at the top of your XSLT map file...
    <!-- reusable replace-string function -->
    <xsl:template name="replace-string">
    <xsl:param name="text"/>
    <xsl:param name="from"/>
    <xsl:param name="to"/>
    <xsl:choose>
    <xsl:when test="contains($text, $from)">
         <xsl:variable name="before" select="substring-before($text, $from)"/>
         <xsl:variable name="after" select="substring-after($text, $from)"/>
         <xsl:value-of select="$before"/>
         <xsl:value-of select="$to"/>
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="$after"/>
    <xsl:with-param name="from" select="$from"/>
    <xsl:with-param name="to" select="$to"/>
         </xsl:call-template>
    </xsl:when>
    <xsl:when test="$text=''">NULL</xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Then you call it from within the XSLT map as follows:-
    <!-- if contains a single quote, replace with 2x single quotes. This makes lookup-table work! -->
    <xsl:variable name="incoming">
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="inp1:myinputfield"/>
    <xsl:with-param name="from">'</xsl:with-param>
    <xsl:with-param name="to" select="'&amp;apos;&amp;apos;'"/>
    </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="dvm-text">
    <xsl:value-of select="orcl:lookup-table('MYLOOKUPTABLE','INVAL',$incoming,'OUTVAL','ds/dev')"/>
    </xsl:variable>
    <!-- lookup-table returns null if input value not found. Output original value instead -->
    <xsl:choose>
    <xsl:when test="$dvm-text=''">
    <xsl:value-of select="inp1:myinputfield"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$dvm-text"/>
    </xsl:otherwise>
    </xsl:choose>
    Much Thanks to everyone who shares information and methods on the Internet!
    Cheers,
    Greg

  • How to create formula with lookup table

    Hi, I would like to convert formula in the below to labview format, any idea how this could be done easiest way?
    I'm planning to use formula node but I'm not not sure about how to use lookup table inside the formula or is it even possible?
    br, Jani
            Dim dblLookUp(,) As Double = New Double(3, 1) {{4, 4}, {10, 200}, {60, 3000}, {100, 7000}}
            If dblAbsValue >= 0 And dblAbsValue <= dblLookUp(0, 0) Then
                dblk = dblLookUp(0, 1) / dblLookUp(0, 0)
                dblValue = dblAbsValue * dblk
                'lblMode.Text = 1
            ElseIf dblAbsValue > dblLookUp(0, 0) And dblAbsValue <= dblLookUp(1, 0) Then
                dblk = (dblLookUp(1, 1) - dblLookUp(0, 1)) / (dblLookUp(1, 0) - dblLookUp(0, 0))
                dblValue = dblk * dblAbsValue - dblk * dblLookUp(0, 0) + dblLookUp(0, 1)
                'lblMode.Text = 2
            ElseIf dblAbsValue > dblLookUp(1, 0) And dblAbsValue <= dblLookUp(2, 0) Then
                dblk = (dblLookUp(2, 1) - dblLookUp(1, 1)) / (dblLookUp(2, 0) - dblLookUp(1, 0))
                dblValue = dblk * dblAbsValue - dblk * dblLookUp(1, 0) + dblLookUp(1, 1)
                'lblMode.Text = 3
            ElseIf dblAbsValue > dblLookUp(2, 0) And dblAbsValue <= dblLookUp(3, 0) Then
                dblk = (dblLookUp(3, 1) - dblLookUp(2, 1)) / (dblLookUp(3, 0) - dblLookUp(2, 0))
                dblValue = dblk * dblAbsValue - dblk * dblLookUp(2, 0) + dblLookUp(2, 1)
                'lblMode.Text = 4
            Else
                dblValue = dblLookUp(3, 1) '* Math.Sign(dblValue)
                'lblMode.Text = 5
            End If
            Return dblValue * intSign
    Solved!
    Go to Solution.

    Hello janijt,
    You can definitely use formula node for it. What you would do is to create a constant array for the lookup table. 
    Here's an implementation in MathScript Node
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • Lookup Table and Target Table are the same

    Hi All,
    I have a requirement in which I have to lookup the target table and based on the records in it, I need to load a new record into the target table.
    Being very specific,
    Suppose I have a key column which when changes I want to generate a new id and then insert this new value.
    The target table record structure looks like this
    list_id list_key list_name
    1 'A' 'NAME1'
    1 'A' 'NAME2'
    1 'A' 'NAME3'
    2 'B' 'NAME4'
    2 'B' 'NAME5'
    As shown the target table list_id changes only when the list key changes. I need to generate the list_id value from within OWB mapping.
    Can anyone throw some light as to how this can be done in OWB???
    regards
    -AP

    Hello, AP
    You underestimate the power of single mapping :) If you could tolerate using additional stage table (with is definitly recomended in case your table from example will account a lot of rows).
    You underestimate the power of single mapping :) It you could tolerate using additional stage table (witch is definitely recommended in case your table from example will account a lot of rows), you could accomplish all you need within one mapping and without using PLSQL function. This is true as far as you could have several targets within one mapping.
    Source ----------------------------------------------------- >| Join2 | ---- > Target 2
    |------------------------ >|Join 1| --> Lookup table -->|
    Target Dedup >|
    Here “Target” – your target table. “Join 1“ – operator covers operations needed to get existing key mapping (from dedup) and find new mappings. Results are stored within Lookup Table target (operation type TRUNCATE/INSERT).
    “Join 2” is used to perform final lookup and load it into the “Target 2” – the same as “Target”
    The approach with lookup table is fast and reliable and could run on Set base mode. Also you could revisit lookup table to find what key mapping are loaded during last load operation.
    Serhit

  • Distinct count using lookup table

    How can I get a distinct count of column values using a different table?
    Let's say I want to get a distinct count of all "company_name" records in table "emp" that corespond (match) with "lookup" table, "state" category.
    What I want is to find counts for all companies that have a value of "california" in the "state" column of the "lookup" Table. I want the output to look like:
    Sears 17
    Pennys 22
    Marshalls 6
    Macys 9
    I want the result to show me the company names dynamically as I don't know what they are, just that they are part of the "state" group in the lookup Table. Does this make sense?
    M

    Mark,
    In the future you might consider creating test cases for us to work with. Something similar to the following where sample data is created for each table as the union all of multiple select statementsselect 'INIT_ASSESS' lookup_type
         , 1 lookup_value
         , 'Initial Assessment' lookup_value_desc
      from dual union all
    select 'JOB_REF', 2, 'Job Reference' from dual union all
    select 'SPEC_STA', 3, 'SPEC STA' from dual;
    select 'INIT_ASSESS' rfs_category
         , 1 val
      from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'SPEC_STA', null from dual;Then we can either take your select statements and make them the source of a CTAS (create table as) statementcreate table lookup as
    select 'INIT_ASSESS' lookup_type
         , 1 lookup_value
         , 'Initial Assessment' lookup_value_desc
      from dual union all
    select 'JOB_REF', 2, 'Job Reference' from dual union all
    select 'SPEC_STA', 3, 'SPEC STA' from dual;, or include them as subfactored queries by using the with statement:with lookup as (
    select 'INIT_ASSESS' lookup_type
         , 1 lookup_value
         , 'Initial Assessment' lookup_value_desc
      from dual union all
    select 'JOB_REF', 2, 'Job Reference' from dual union all
    select 'SPEC_STA', 3, 'SPEC STA' from dual
    ), RFS as (
    select 'INIT_ASSESS' rfs_category
         , 1 val
      from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'JOB_REF', 1 from dual union all
    select 'SPEC_STA', null from dual
    select lookup_value_desc, count_all, count_val, dist_val
      from lookup
      join (select rfs_category
                 , count(*) count_all
                 , count(val) count_val
                 , count(distinct val) dist_val
              from RFS group by rfs_category)
        on rfs_category = lookup_type;Edited by: Sentinel on Nov 17, 2008 3:38 PM

  • MDM Data model design for Main table visa vis lookup table

    Hi ,
    I would like to know whether the legal entities or Address table which are common for all MDM main tables like Customer ,Vendor,Material,Business Partner etc can also become a main table when their attributes are around 30-40 range.
    Is it a sound design approach to make Company table with about 50 attributes and say address table with 20 attributes as Main table and replicate a small company-id table with 2 or 3 attributes to link to the main table(company)? This will ensure replicating that small table(company-id) to all other Main tables(customer,vendor,......) instead of replicating that big company table as lookup for all main tables?
    Thanks in advance for any idea or feasibility comments.
    -reo

    Hi, Deepak
    >>> - How can I populate the data in the lookup table at the same time when I am populating the main table ? I have only the XML's that correspond to the main table . I don't have seperate data for the lookup tables .
    I don't think you can populate both main table and all fields of lookup tables at the same time, i.e. using same map. You can consider 2 options to upload all information you have:
    1) If your XML file contains data you would like to upload to lookup tables, you can upload it to MDM lookup tables with several maps using same XML and choosing different sections of that XML corresponding to different MDM lookup tables.
    2) Also you can upload main table simultaneously with lookup table entries (using same map), but in this case new lookup table entries will only contain display field values that you mapped. To do this you should use 'Add' value mapping functionality for fields that you mapped to lookup tables.
    >>>- Can I use the standard maps available for import in the business content of material repository in MDM ?
    1) In case you have material master repository delivered by SAP and you use XML files which structure corresponds to SAP predelivered XSD schemas then you can use these maps undoubtedly.
    2) If your repository is based on SAP predelivered, but you changed it ,you should adjust these maps due to differences in repository structure and  XML files structure.
    3) If you created your repository from scratch you should consider option of making your own import maps.
    Regards,
    Vadim Kalabin

  • Clarity/shadows + distortion correction = terrible artefacts in high contrast areas

    common example (clarity and shadows +100):
    without distortion correction
    with distortion correction
    Raw file: nycz.info/temp/castle.dng

    The adhoc fix I'm using for images where it's causing problems is to paint out the problem areas with a localised adjustment brush with a very large hit of negative clarity. As most of the problem areas have been pretty small it's an easy fix, but I'd like to see the issue addressed before the final comes out as close examination has shown it up on quite a few images (reflective mike against black stage background, pier edges against a bright but cloudy sky, tree branches against the sky). I've also now set my default to having lens profile distortion off and only using it where I need it.
    Edit to add: Unfortunately on the image I'm working on at the moment, it only removes it as long as clarity is set to less than 50 - I need the lens adjustment to get the horizon flat, and I want the clarity, but if I try to have both I'm getting nasty white streaks along the pylons of a pier and it shows at screen size  let alone on prints or 100 per cent view.  With this particular image any amount of clarity over about 15 and the profile image adjustment is producing ghastly results, visible at small sizes.
    Edit again - urggggh. Manual adjustment to level horizons (beach images again) using lens correction plus clarity isn't good either. I've got rather a lot of those and basically can't use any amount of clarity or I start getting areas of light stripes along dark high contrast edges. However if i go to the crop and straighten settings,  and straighten there, it's fine.
    Edit again: Ok this is an app killer. Back to Lightroom 4.0 (If I can work out how!). Too many of my images are affected, and affected noticeably. What a shame as the defringing in RC2 is absolutely fantastic on long lenses, but this is affecting too much stuff.
    I'm getting it  on quite a few images I've done nothing to excepted converted them to LR4 - it's very clear on the before/after previews of PV2010 and PV2012. And the edges don't have to be that high contrast - I'm not sure if this screen shot shows it clearly enough but conversion gives a row of little white dashes along the green girder in the attached images Click on images to see them a bit larger- the first image shows small size before and after comparison with problem area highlighted - nothing done except change process PV2010 to PV2012; second image shows PV2012 magnified a bit. Turning off the enable profile corrections button returns image to PV2010 appearance. Removing  clarity  adjustment will also remove artifacting -  in this case it's the clarity that is mucking things up. I can get the same artefacts with clarity on zero and the shadows pushed up above 70. Clarity gives problems at much lower settings.

  • Best way to do a lookup with multiple tables

    Hello,
    I am looking for an example or how to do a lookup through ESB XSL transformation. What I am wanting to accomplish is something like below:
    I am reading in a flat file and then want to use a field in that file to do a lookup in multiple tables.
    i.e.
    Select c.customer_name
    from customers c, order_lines ol, order_headers oh
    where ol.customer_id = c.customer_id
    and ol.header_id = oh.header_id
    and oh.order_number = p_order_num;
    I know that there is the lookup-table function but didnt know if that would work with this scenario. Any suggestions are appreciated.
    Thanks,
    Jason
    Edited by: Colby J on Oct 21, 2008 11:13 AM

    Hello,
    I am looking for an example or how to do a lookup through ESB XSL transformation. What I am wanting to accomplish is something like below:
    I am reading in a flat file and then want to use a field in that file to do a lookup in multiple tables.
    i.e.
    Select c.customer_name
    from customers c, order_lines ol, order_headers oh
    where ol.customer_id = c.customer_id
    and ol.header_id = oh.header_id
    and oh.order_number = p_order_num;
    I know that there is the lookup-table function but didnt know if that would work with this scenario. Any suggestions are appreciated.
    Thanks,
    Jason
    Edited by: Colby J on Oct 21, 2008 11:13 AM

  • Is Mapping Lookup table possible with IDOC to FIle scenario

    Hi all,
    Need suggestion, I am using SP16
    My sceanrio is IDOC to FIles, and have to use a Mapping Lookup tables for some of the fields within the mapping...
    'Crossref:  PlantLoc_to_WhseComDiv.  Value mapping lookup to take two fields from SAP and convert to WMS 3-digit value'
    How to go with this, since i have checked in SAP library that it is for only RFC,JDBC,SOAP adapters ...
    Need u r valuable inputs,
    Regards,
    sridhar

    You can use RFC or SOAP or JDBC lookup in your mapping.Why not?..It does not mean that we use the lookups only in RFC secnarios.You can use them in any scenario.

  • What can you do with Color Lookup Tables (CLUT) and other ranges.?

    Ok.... I might be repeating something.... but someone
    suggested to post this as it hasn't be answered....
    Anyway I'm curious on what you can do with Color Lookup
    Tables (CLUT) in Fireworks.... I've been looking for details on
    CLUT, but have only found information on what it's all about....
    Alright, to the point, I'm kind of having some trouble on
    what to do period with them....in the optimize panel in Fireworks I
    saved the Palette, of all the colors I wanted (or so it seemed,
    idk), and made it so it would be for a PNG 32 file... *is this
    suppose to be an .act file too?*.... I then took the image to have
    the colors replaced to the ones I saved in the custom color
    table... so I tried loading the .act file I had saved, that had the
    colors I made for the other image, but nothing happened... so I
    tried doing other various types of files..... I tried doing it as a
    .gif, and it work.... but the thing is I don't want it to be a
    gif... and yes, it is kind of vague, but I really don't know what
    to really do....
    Is there only certain ways that you can load up CLUT files
    into different pictures...?? I want this picture to be a .png file
    too, so is there any way to save the color palette, and load them
    into these type of files..?? or it can't be done with them..??
    overal, I want this image to be .png files... is there any
    tutorial or info on this..?? it would be quite helpful...

    AarokBomB wrote:
    > Is there only certain ways that you can load up CLUT
    files into different
    > pictures...??
    Choose File > Image Preview > Options tab. Set the
    format type to PNG 8,
    GIF, TIFF 8, or BMP 8. Click on the small button to the right
    of the
    Format drop down menu to open the tab options menu. Choose
    Load Palette
    and browse to the .act palette you you have saved. Clock on
    OK to accept
    the changes and close the dialog box. The imported color
    table will be
    applied to the image.
    Linda Rathgeber [PVII] **Adobe Community Expert-Fireworks**
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/
    Design Aid Kits:
    http://www.webdevbiz.com/pwf/index.cfm

  • Real Time Simulation, problem with the 3D Lookup table

    Hello,
    I have a problem with LabVIEW RT. I want to read under the parameters of temperature, time and voltage, the current out of a matrix.
    The matrices differ only in the temperature (first entry in a matrix).
    If the 3D Lookup table only get one matrix, I often get "Not a Number" as result. But not always, although the parameters remain the same.
    If the 3D Lookup table gets three or more matrices, the result never be "Not a Number". But the 2 other matrices are "dummys" filled up with zeros, expect the temperature. Also the problem appears only if I start the test sequence as Startup on the RT-System. If I start the test sequence from the Front Panel, the 3D Lookup table works well, whether one or more than three matrices!
    Its confusing, I know ^^
    The appendices contains pictures from a matrix an from the Block Diagram
    Attachments:
    Block DIagram.jpg ‏146 KB
    Current-Matrix.png ‏27 KB
    Dummy-Matrix.png ‏12 KB

    Hello salomon,
    The 3D lookup table is not generated in my code, but is invoked as a constant. I examine the behavior of electrical loads in the cars. Consumers were in a climate chamber measured at various temperatures and these values ​​were packed into a 3D lookup.
    Helps you even further? : D

  • Lookup table with a block based on a view

    Hi!
    My form contain one module component based on a view, one of the items of my block is a libelle that exist in one
    of the tables queried by the view.
    my question is :
    how can I have a LOV on this item in order that the user select a value for a query???
    or, can I make a lookup table with a view ????
    Thanks!

    You said you copied an existing item in the block, and then copied an existing item in the layout editor - is it possible you actually created 2 separate items? Remove the one in the layout editor, and set the canvas of the one in the block so it is displayed in the layout editor. That could be the problem.

  • How to fill Lookup table run time with desired values in project server 2010.

    HI,
    is this possible to fill LookUp Table with some Desired Values at Runtime ??
    Or How to bind a LookUp table with DataBase  Table??

    Dear Rohan,
    You need to do this via PSI script for lookup table.
    Follow this blog Chris Boyd:
    http://blogs.msdn.com/b/project_programmability/archive/2006/11/08/adding-a-project-to-a-category.aspx
    Regards,
    Avinash kumar | Blog:http://avigr8.wordpress.com | If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.

  • How can i creat CRC 32 CHECK WITH THE lookup table as attached.

    how can i creat CRC 32 CHECK WITH THE lookup table.attached
    i creat one,but not match the result number C++ version
    result number C++ version:
    FE 00 18 02 40 1E 65 43 00 03 E8        CRC32=>78 1F E9 06
    FE 01 18 02 40 1E 65 43 00 03 E8        CRC32=>F8 8F 49 61
    FE 02 18 02 40 1E 65 43 00 03 E8        CRC32=>7D FF B4 7F

    due to some reason i can not attach the table.but you can find it herehttp://lavag.org/topic/15325-crc32/,it in the CRC.llb 84.03K =>CRC-32 Table.ctl thanks a lot

Maybe you are looking for

  • Error when open UDO form generator

    when i try to open udo form gen .the following error arises. ERROR The Type initializer for 'B1 Wizard.Globals' threw an exception Pls tell me how to resolve it

  • Integrating a Predictive Dialer with COD

    We are in the process of implementing Contact on Demand with CRM OnDemand. We have users that do nothing but make outbound calls and we were going to load campaigns and use leads to make those calls and record dispositions. We would also like to use

  • Output allaingment problem(please urgent help)

    i made report by report biulder and the output was ok but i have onr problem in one fathername header was out off records line as the below example studentid_ school class section fathername adress osama 2 2 1 dubai jamal ahmad 3 2 2 dubai osama amja

  • STO and Multiple Schedule Line

    Hi, we create STO and we trigger ATP in SCM. We are currently getting multilple schedule lines. Then if you create a sales order and trigger ATP check it does not see all the schedule lines on the STO. It only sees the requested date and requested QT

  • Not allowing to save changes in program

    When i try to make some changes in Standard program and then save it, i create a new request for it and then try to save. It flashes a msg : "SAP names file for TCS_ABAP locked by another process" ...and does not let me save changes.But it does creat