TIOVX User Guide
image.py
1 #
2 # Copyright (c) 2017 Texas Instruments Incorporated
3 #
4 # All rights reserved not granted herein.
5 #
6 # Limited License.
7 #
8 # Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
9 # license under copyrights and patents it now or hereafter owns or controls to make,
10 # have made, use, import, offer to sell and sell ("Utilize") this software subject to the
11 # terms herein. With respect to the foregoing patent license, such license is granted
12 # solely to the extent that any such patent is necessary to Utilize the software alone.
13 # The patent license shall not apply to any combinations which include this software,
14 # other than combinations with devices manufactured by or for TI ("TI Devices").
15 # No hardware patent is licensed hereunder.
16 #
17 # Redistributions must preserve existing copyright notices and reproduce this license
18 # (including the above copyright notice and the disclaimer and (if applicable) source
19 # code license limitations below) in the documentation and/or other materials provided
20 # with the distribution
21 #
22 # Redistribution and use in binary form, without modification, are permitted provided
23 # that the following conditions are met:
24 #
25 # No reverse engineering, decompilation, or disassembly of this software is
26 # permitted with respect to any software provided in binary form.
27 #
28 # any redistribution and use are licensed by TI for use only with TI Devices.
29 #
30 # Nothing shall obligate TI to provide you with source code for the software
31 # licensed and provided to you in object code.
32 #
33 # If software source code is provided to you, modification and redistribution of the
34 # source code are permitted provided that the following conditions are met:
35 #
36 # any redistribution and use of the source code, including any resulting derivative
37 # works, are licensed by TI for use only with TI Devices.
38 #
39 # any redistribution and use of any object code compiled from the source code
40 # and any resulting derivative works, are licensed by TI for use only with TI Devices.
41 #
42 # Neither the name of Texas Instruments Incorporated nor the names of its suppliers
43 #
44 # may be used to endorse or promote products derived from this software without
45 # specific prior written permission.
46 #
47 # DISCLAIMER.
48 #
49 # THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
50 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 # IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
53 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
54 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
55 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
56 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
57 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
58 # OF THE POSSIBILITY OF SUCH DAMAGE.
59 #
60 #
61 
62 from . import *
63 
64 
72 
84  def __init__(self, dim_x, dim_y, stride_x, stride_y, scale_x=1024, scale_y=1024, step_x=1, step_y=1) :
85  self.dim_x = dim_x
86  self.dim_y = dim_y
87  self.stride_x = stride_x
88  self.stride_y = stride_y
89  self.step_x = step_x
90  self.step_y = step_y
91 
92 
104 class Image (Reference) :
105 
116  def __init__(self, width, height, df_image, access_type="Host", in_file_addr="./", out_file_addr="./", name="default") :
117  Reference.__init__(self, Type.IMAGE, name)
118  self.width = width
119  self.height = height
120  self.df_image = df_image
121  self.access_type = access_type;
122  self.in_file = in_file_addr;
123  self.out_file = out_file_addr;
124 
125  def __str__(self):
126  return Reference.__str__(self) + ' [ ' + str(self.width) + 'x' + str(self.height) + ':' + self.df_image.name + ' ]'
127 
128 
141 
148  def __init__(self, image, channel, name="default") :
149  df_image = DfImage.INVALID
150  if(channel == Channel.Y) :
151  if(image.df_image in [ DfImage.NV12, DfImage.NV21, DfImage.IYUV, DfImage.YUV4]) :
152  df_image = DfImage.U8
153  if(channel == Channel.U or channel == Channel.V ) :
154  if(fimage.df_image in [ DfImage.IYUV, DfImage.YUV4]) :
155  df_image = DfImage.U8
156  Image.__init__(self, image.width, image.height, df_image, name)
157 
158 
171 
178  def __init__(self, df_image, image_patch_address, name="default") :
179  Image.__init__(self, image_patch_address.dim_x, image_patch_address.dim_y, df_image, name)
180  self.image_patch_address = image_patch_address
181 
182 
Image patch object (OpenVX equivalent = vx_imagepatch_addressing_t)
Definition: image.py:71
Image object (OpenVX equivalent = vx_image, specifically returned from vxCreateImage) ...
Definition: image.py:104
def __init__(self, dim_x, dim_y, stride_x, stride_y, scale_x=1024, scale_y=1024, step_x=1, step_y=1)
Constructor used to create this object.
Definition: image.py:84
Image from channel object (OpenVX equivalent = vx_image, specifically returned from vxCreateImageFrom...
Definition: image.py:140
def __init__(self, image, channel, name="default")
Constructor used to create this object.
Definition: image.py:148
def __init__(self, df_image, image_patch_address, name="default")
Constructor used to create this object.
Definition: image.py:178
def __init__(self, width, height, df_image, access_type="Host", in_file_addr="./", out_file_addr="./", name="default")
Constructor used to create this object.
Definition: image.py:116
Image from handle object (OpenVX equivalent = vx_image, specifically returned from vxCreateImageFromH...
Definition: image.py:170