Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

sizesMatch

Class: imref3d

True if object and image are size-compatible

Syntax

TF = sizesMatch(R,A)

Description

TF = sizesMatch(R,A) returns true if the size of the image A is consistent with the ImageSize property of the spatial referencing object R. That is, R.ImageSize == [size(A,1) size(A,2) size(A,3)].

Input Arguments

R

Spatial referencing object, imref3d, associated with an image.

A

Input image

Output Arguments

TF

Logical scalar

Examples

expand all

Read an image.

 I = imread('peppers.png');

Create an imref3d object and associate it with the image.

 R = imref3d(size(I))
R = 

 imref3d

  Properties:
           XWorldLimits: [0.5000 512.5000]
           YWorldLimits: [0.5000 384.5000]
           ZWorldLimits: [0.5000 3.5000]
              ImageSize: [384 512 3]
    PixelExtentInWorldX: 1
    PixelExtentInWorldY: 1
    PixelExtentInWorldZ: 1
    ImageExtentInWorldX: 512
    ImageExtentInWorldY: 384
    ImageExtentInWorldZ: 3
       XIntrinsicLimits: [0.5000 512.5000]
       YIntrinsicLimits: [0.5000 384.5000]
       ZIntrinsicLimits: [0.5000 3.5000]

Check if the size of the image matches the size in the object.

 tf = sizesMatch(R,I)
tf =

     1

Read another image that is a different size.

 I2 = imread('coins.png');

Check if the size of this image matches the size in the object. It should return false.

  tf = sizesMatch(R,I2)
tf =

     0
Was this topic helpful?