-
Notifications
You must be signed in to change notification settings - Fork 0
Script Builtin Apis
linwe2012 edited this page Dec 16, 2018
·
7 revisions
function imread(ImageName) {}
reads in image according to ImageName
, returns the image object
param | type | description | note |
---|---|---|---|
ImageName | string |
the path of the image desired to read | - |
RETURN |
Image |
the image read | - |
Sample Usage
im = imread("moon.png")
function imread(ImageName, Image) {}
reads in image according to ImageName
, returns the image object
param | type | description | note |
---|---|---|---|
ImageName | string |
the path of the image desired to write | - |
Image | Image |
the image object | - |
RETURN |
- | no returns | - |
Sample Usage
im = imread("moon.png")
imwrite("moon_copy.png")
function fspecial(Filter, ...) {}
reads in image according to ImageName
, returns the image object
param | type | description | note |
---|---|---|---|
Filter | string |
string that name sepcifies the filter | See Filters Names |
RETURN |
pod |
plain old pointer | - |
Filter Name | Params Required | Description |
---|---|---|
"laplacian" |
- | laplacian operator, |
"gaussian" |
[array ] - specifies the size of the filter [ double ] - specifies sigma |
- |
"average" |
[array ] - specifies the size of the filter |
- |
Sample Usage
filter_size = [3, 3]
lap = fspecial("laplacian")
avg = fspecial("average", filter_size)
gau = fspecial("gaussian", [15, 15], 3.0)
function imfilter(Image, Filter, Filter_Size)
function imfilter(Config)
param | type | description | Default | note |
---|---|---|---|---|
Image | Image |
The Image To be filtered | - | |
Filter | pod |
filter generated by fspecial
|
- | |
Filter_Size | array |
size of the filter | [3, 3] |
|
RETURN |
Image |
Image after filtering | x |
Another Usage
param | type | description | Default | note |
---|---|---|---|---|
Config | object |
Object specifies options | - | See Config Options |
RETURN |
Image |
Image after filtering | x |
Config Options | type | default | note |
---|---|---|---|
filter | pod |
- | filter generated by fspecial()
|
filter_size | array |
[3,3] |
filter size |
filter_factor | double |
1 |
All element of filter will multiple the filter |
src | Image |
- | Source Image |
bounds |
array or object
|
[[0,0],[1,1]] |
See description below |
-
Bounds specifies which part of the image will be filtered.
-
It can be an array of 2 coordinate, first specifies the left bottom and second specifies right top
-
It can be an object specifies left, right, top, and bottom position from the origin
-
Sample Usage
filter_size = [3, 3]
im = imread("gorilla.jpg")
average = imfilter(im, fspecial("average", filter_size), filter_size)
config = {
filter_size : [15, 15],
filter_factor: 1.3, //every elem of filter will multiply the factor
filter : fspecial("gaussian", [15, 15], 3.0),
src : im,
bounds : [[0, 0], [.5, .5]]
}
imwrite("gorilla_gaus_quater.png", imfilter(config))