Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:16:02+00:00 2026-06-04T05:16:02+00:00

I transformed an image using meshgrid , but the new coordinates are partially outside

  • 0

I transformed an image using meshgrid, but the new coordinates are partially outside the range of the original image, causing the transformation to fail.

First I used clip

...
tX = numpy.clip(tX.astype(numpy.int),0,image.w)
tY = numpy.clip(tY.astype(numpy.int),0,image.h)
result image([tX,tY])

which resulted in effect similar to the ‘nearest’ boundary condition.

I would like for all the outside pixels to be black. I thought I could achieve this by using a boolean array on the meshgrid, but I don’t know how to apply the boolean array to the meshgrid correctly.

tXbool = numpy.abs(tX) < image.w
tXbool.shape
(850, 1280)
tX[tXbool].shape
(193180,)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:16:03+00:00Added an answer on June 4, 2026 at 5:16 am

    Okay, thats how I did it in the end:

    tXbool = (0 < tX) & (tX  < image.w )
    tybool = (0 < tY) & (tY  < image.h )
    outliers = tXbool & tybool
    
    mask = where(outliers,1,0)
    mask4channels = dstack([mask,mask,mask])
    image = image*mask4channels
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can somebody give a good explanation of FFT image transform How the FFT transformed
I have problem to draw line on scaled and transformed image on canvas, well
So I have a 3D image that's getting transformed into a space via an
I am using OpenXML to insert an image into my document. The code provided
I'm using CGAffineTransformRotate and CGAffineTransformTranslate to animate the progress of a car image (UIImageView)
I wrote a sample code for image transforming from top to bottom, by using
I trying to spin an image using CSS keyframes to rotate(360deg) . I used
I am trying to animate an image using following code: [UIView beginAnimations:nil context:NULL]; [UIView
I am trying to append an image to a page using JavaScript: image =
I am uploading some image files using servelt. I want to resize the images.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.