Closed kota7 closed 7 years ago
I'm sorry for the late reply,
If you are not in a hurry, I'll come with a fix either tomorrow or the day after tomorrow.
I added the padded_value parameter to both the Augmentation and the translation functions. Besides 0 it can take posiitve, negative or float values. Please test the new version using devtools::install_github('mlampros/OpenImageR') (it will take some time till the new version of the package is on CRAN) and let me know.
Hi, thanks for your quick response! It now works good for my case (matrix image).
I have a suggestion for 3d-array case.
library(OpenImageR)
object <- array(1, dim = c(10, 10, 3))
Augmentation(object, shift_rows=2, padded_value=0.5)
The code above pads a certain value into all three dimension. Assuming each dimension corresponds to R,G,B, this means we can pad black, white, or any gray colors.
Some may wish to pad by red, i.e. (1,0,0)
, but the code below does not work.
Augmentation(object, shift_rows=2, padded_value=c(1,0,0))
#Error in augment_transf_array(image, flip_mode, crop_height, crop_width, :
# expecting a single value
Allowing padded values of vector of size equal to the channel dimension size can be a good enhancement.
I added the functionality that you suggested in both translation and Augmentation functions. The padded_value parameter can be either a numeric value (of length 1) or a numeric vector (of length equal to the dimensions of the array). I'll add exception handling in the next few days. Please test it and let me know.
Beautiful. It works great.
Quick check I have run:
library(OpenImageR)
object <- matrix(1, nrow=2, ncol=5)
Augmentation(object, shift_cols=1, padded_value=-5)
object <- array(1, dim = c(4, 2, 3))
Augmentation(object, shift_rows=1, padded_value=0.5)
Augmentation(object, shift_rows=1, padded_value=c(3,4,5))
Hi, I have a matrix representing a gray-scale image like below. In this matrix, 0 represents black and 1 represents white.
This looks like![1](https://cloud.githubusercontent.com/assets/12293919/25470110/64bf5ae4-2b5b-11e7-86cc-0388bab451a0.png)
When I used
Augmentation
function withshift_rows
orshift_cols
options, I get the following.This looks like below.![1b](https://cloud.githubusercontent.com/assets/12293919/25470368/de4f8ee6-2b5c-11e7-8e9a-091cbf9937c2.png)
So, the padded value is always 0, where I want to use 1 to fill and I could not find a way to choose it. It would be great if I can freely chose the default value to be filled in.
Thanks.