Removing trend by performing differencing in Time series prediction - time-series

On the basis of literature, for temporal correlation modeling the trend should be removed from the time-series data. We choose differencing for removing the trend.
I would like to know:
When we perform the differencing the data completely change and subsequently the predictions will be changed.
For example, if we suppose the range of data is 7.9, 7.25, 6.98 and ..., then after performing the differencing the predictions will be below the 1.
How should we assess the predictions in real world data?
Should we perform the similar differencing on a reference data, too?
I am using AR(p) temporal model. Additionally, the process is implemented in R software.
Data sample (rn25_29_o):
class = c("POSIXct",
"POSIXt"), tzone = "")), .Names = c("ambtemp", "dt"), row.names = c(NA,
486L), class = "data.frame")
ambtemp dt
1 -1.96 2007-09-28 23:55:00
2 -2.02 2007-09-28 23:57:00
3 -1.92 2007-09-28 23:59:00
4 -1.64 2007-09-29 00:01:00
5 -1.76 2007-09-29 00:03:00
6 -1.83 2007-09-29 00:05:00
dput(Dif_Median_ambtemp)
structure(c(NA, 0.2, 0.16, -0.0700000000000001, -0.1, -0.04,
-0.01, 0, 0.0700000000000001, 0.23, 0.16, -0.26, -0.3, -0.18,
0, -0.04, -0.04, 0.14, 0.14, 0.14, -0.02, -0.0999999999999999,
0, 0.16, 0.0900000000000001, 0.28, 0.27, -0.17, -0.17, 0, -0.02,
-0.12, -0.1, 0, -0.05, -0.0800000000000001, -0.0699999999999998,
0, 0.03, -0.00999999999999979, 0, 0.0999999999999999, 0.0999999999999999,
0.0800000000000001, 0.12, 0.24, 0.26, 0.0999999999999999, 0.0599999999999998,
0.02, 0, -0.02, -0.0599999999999998, -0.0399999999999998, 0,
0, -0.02, -0.0700000000000001, -0.24, -0.37, -0.22, -0.0799999999999998,
-0.03, -0.12, -0.03, 0.1, 0.02, 0.14, 0.18, 0.0600000000000001,
0, -0.02, -0.0600000000000001, -0.04, 0, -0.02, -0.0999999999999999,
-0.11, -0.16, -0.13, 0.0800000000000001, 0.0800000000000001,
0, 0.01, 0.12, 0, 0.22, 0.23, -0.1, -0.0800000000000001, -0.0800000000000001,
0, 0, 0.02, 0.28, 0.3, 0.04, -0.0900000000000001, -0.0900000000000001,
-0.01, -0.22, -0.37, -0.16, 0, -0.32, -0.45, -0.13, 0.04, 0.04,
0, 0.1, 0.12, 0.0399999999999996, 0, 0, -0.12, 0, 0.14, 0.02,
0, 0.02, 0.34, 0.3, -0.0800000000000001, -0.0900000000000001,
-0.01, -0.01, -0.12, -0.11, 0, -0.17, -0.17, -0.16, -0.16, 0.24,
0.24, 0.0900000000000003, 0.0900000000000003, 0, 0.11, 0.41,
0.45, 0.27, 0, -0.15, -0.03, 0.0600000000000001, 0.0800000000000001,
0.0600000000000001, 0.04, 0, -0.04, -0.0600000000000001, -0.14,
-0.18, -0.0600000000000001, -0.01, -0.26, -0.32, -0.22, -0.15,
0.12, 0.18, 0.0600000000000001, 0, 0.0800000000000001, 0, -0.11,
-0.0299999999999998, 0.2, 0.33, 0.13, 0.0600000000000001, 0.0600000000000001,
-0.01, -0.03, -0.15, -0.15, -0.0799999999999998, -0.0899999999999999,
-0.04, -0.01, -0.01, -0.0600000000000001, -0.05, 0, 0.02, 0.05,
0.18, 0.17, 0.05, 0.0800000000000001, 0.0600000000000001, 0.3,
0.34, 0.0499999999999998, 0.02, 0.05, 0.03, -0.23, -0.48, -0.33,
-0.13, -0.14, -0.11, -0.02, 0.04, 0.0800000000000001, 0.0800000000000001,
0.13, 0.15, 0.0700000000000001, 0.01, -0.02, -0.0800000000000001,
-0.0600000000000001, -0.04, -0.0799999999999998, -0.0499999999999998,
-0.04, -0.03, -0.04, -0.0600000000000001, -0.02, 0.02, 0.04,
0.04, 0.02, 0, 0, 0, 0, 0.02, 0.02, 0, 0.02, 0.0399999999999998,
0.0199999999999998, 0, 0.14, 0.31, 0.19, 0.02, -0.01, -0.0700000000000001,
-0.23, -0.2, -0.03, 0, -0.0799999999999998, -0.0799999999999998,
0.44, 0.54, 0.0999999999999999, 0.1, 0.1, 0.26, 0.26, 0, 1.08,
1.08, -0.24, -0.62, -0.44, -0.18, -0.02, 0, 0, 0.01, 0.16, 0.55,
0.3, 0.26, 0.18, 0.18, 0.26, 0, -0.37, -0.37, 0.18, 0.41, 0.35,
0.12, -0.73, -0.73, 0.07, 0.23, 0.16, -0.26, -0.26, 0.4, 0.4,
0, 0.08, 1.1, 1.02, -0.27, -0.62, -0.84, -0.49, 0.19, 1.29, 1.12,
0.62, 0.76, 0.48, 0.32, -0.82, -0.92, -0.17, -0.19, -0.33, -0.21,
0, 0, 0.44, 0.98, 0.65, 0.11, -0.13, -0.13, -0.44, -0.89, -0.45,
0.17, 0.17, 0.38, 0.4, 0.3, 0.16, 0, 0.5, 0.38, -0.22, -0.72,
-0.65, 0, 0.38, 0.23, 0.0900000000000001, 0.25, 0.16, 0.66, 0.66,
0, -1.09, -1.09, 0.17, 0.91, 0.8, 0.0599999999999996, 0, -0.21,
-0.21, -0.0299999999999998, -0.0299999999999998, 0.16, 0.58,
0.42, 0.62, 0.66, 0.0399999999999996, -0.96, -0.96, 0, 0, -0.04,
-0.04, 0.71, 0.71, -0.27, -0.27, -0.54, 0.91, 1.44, 0.0599999999999996,
0, -0.19, -0.379999999999999, -0.26, -0.0600000000000001, -0.0600000000000001,
0.28, 0.45, 0, -0.22, -0.0499999999999998, 0.37, 0.57, 0.600000000000001,
0, -0.95, -0.55, 0.21, 1.16, 0.04, -0.510000000000001, 0.0800000000000001,
-0.22, 0.0999999999999996, 0.29, 0.29, -0.84, -0.84, 0.82, 0.87,
0.0499999999999998, -0.34, -0.34, 0.0599999999999996, 0.0699999999999994,
0.00999999999999979, 0, 0.31, 0.220000000000001, -0.0899999999999999,
0, 0.199999999999999, 0.43, 0.23, -0.12, -0.12, -0.0199999999999996,
-0.0199999999999996, 0, 0.52, 0.52, -0.44, -0.44, -0.0700000000000003,
0.38, -0.29, -0.590000000000001, 0.149999999999999, 0, -0.34,
-0.34, 0.350000000000001, 0.4, 0.0499999999999998, 0, 0.0700000000000003,
0.0700000000000003, -0.0800000000000001, -0.0800000000000001,
0, 0.0800000000000001, 0.66, 0.58, 0, 0.0499999999999998, 0.0499999999999998,
-0.0300000000000002, -0.0300000000000002, -0.17, -0.42, -0.42,
-0.37, -0.2, -0.13, 0.04, 0.17, 0.64, 0.71, 0.2, 0.13, 0.17,
-0.51, -0.399999999999999, 0, 0, 0.26, -0.0200000000000005, 0,
0.44, 0.75, 0.31, 0, -0.3, -0.3, 0, 0.00999999999999979, 0.00999999999999979,
NA), .Dim = c(484L, 1L), .Dimnames = list(NULL, "ambtemp"))
dput(x.fore)
structure(list(pred = structure(c(5.77898604276542, 5.76851499635615,
5.75806783191914, 5.74764449498526, 5.73724493120963), .Tsp = c(487,
491, 1), class = "ts"), se = structure(c(0.32761784341869, 0.40079130692622,
0.46226728095271, 0.516242830302498, 0.564873114585049), .Tsp = c(487,
491, 1), class = "ts")), .Names = c("pred", "se"))
Code:
require(zoo)
require(xts)
n= 3
ambtemp <- subset(rn25_29_o, select=c("ambtemp")) # creating subset which includes only "ambtemp" column
Median_ambtemp <- rollmedian(ambtemp,n,fill = list(NA, NULL, NA)) # smoothing the data
Dif_Median_ambtemp <- diff(Median_ambtemp, 2)
te = (x.fit = arima(Dif_Median_ambtemp, order = c(1, 0, 0))) # fit the model and print the results
x.fore = predict(te, n.ahead=5)

This is not a replicable example (which package should I load to use rollmedian, what is the value of n? it is better to post the output of dput(rn25_29_o) so that we don't need to guess the structure of the data? Anyway, looking at the code I see that the following should adjust the forecasts to have the same level as Median_ambtemp:
diffinv(x.fore$pred, lag = 2, xi = tail(Dif_Median_ambtemp, 2))

Related

Image Processing - Skimage or other

I am new to image processing. I am trying out a few experiments.
I have binarized my image with otsu
Found connected pixels with skimage
from PIL import Image
import numpy as np
import skimage
im = Image.open("DMSO_Resized.png")
imgr = im.convert("L")
im2arr = np.array(imgr)
arr2im = Image.fromarray(im2arr)
thresh = skimage.filters.threshold_otsu(im2arr)
binary = im2arr > thresh
connected = skimage.morphology.label(binary)
I'd now like to count the number of background pixels that are either "completely" covered by other background pixels or "partially" covered.
For example, pixel[1][1] is partially covered
1 0 2
0 0 0
3 0 8
AND
For example, pixel[1][1] is completely covered
0 0 0
0 0 0
0 0 0
Is there a skimage or other package that has a method to do these ? Or would I have to implement them as an array processing loop ?
import numpy as np
from skimage import morphology
bad_connection = np.array([[1, 0, 0, 0, 1],
[1, 0, 0, 0, 1],
[1, 0, 0, 0, 1],
[1, 0, 1, 0, 1],
[1, 0, 0, 0, 1]], dtype=np.uint8)
expected_good = np.array([[0, 0, 1, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]], dtype=np.uint8)
another_bad = np.array([[1, 0, 0, 0, 1],
[1, 1, 0, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 0, 1, 1],
[1, 0, 0, 0, 1]], dtype=np.uint8)
another_good = np.array([[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]], dtype=np.uint8)
footprint = np.array([[1, 0, 0, 0, 1],
[1, 0, 0, 0, 1],
[1, 0, 0, 0, 1]], dtype=np.uint8)
Outputs (incorrect or not as expected):

iOS Swift Highcharts Pie with Gradient Fill is black

I am using this example to create a pie chart on iOS:
https://www.highcharts.com/ios/demo/pie-gradient
The pie chart renders fine but the gradient fill is only black color. I converted the code in example to Swift like this:
let colors = [
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#7cb5ec" ],[1, "rgb(48,105,160)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#434348" ],[1, "rgb(0,0,0)"]])!,
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#90ed7d" ],[1, "rgb(68,161,49)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#f7a35c" ],[1, "rgb(171,87,16)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#8085e9" ],[1, "rgb(52,57,157)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#f15c80" ],[1, "rgb(165,16,52)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#e4d354" ],[1, "rgb(152,135,8)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#2b908f" ],[1, "rgb(0,68,67)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#f45b5b" ],[1, "rgb(168,15,15)"]]),
HIColor(radialGradient: ["cx": 0.5, "cy": 0.3,"r": 0.7],
stops: [[ 0, "#91e8e1" ],[1, "rgb(69,156,149)"]])
]
In the given example, they have assigned colors array to options.colors but it takes only String array and not HIColor array. Here's the error I am getting:
error.png
In order to fix the error, here's the code modification I tried which gives black colored pie:
let colors_str = colors.map{
(color: HIColor!) -> String in
let c = color.getData().debugDescription
.replacingOccurrences(of: "Optional(", with: "")
.replacingOccurrences(of: "\n", with: "")
.replacingOccurrences(of: "\"", with: "")
.dropLast()
let value = String(c)
return value
}
options.colors = colors_str
black-pie-chart
Any help will be highly appreciated.
I found the solution to this problem. Wanted to post it since I spent a day on it and in case someone else faces the same issue. So the code of iOS on Highcarts samples is incorrect. I referred to the Javascript code of same pie and found out that colors is assigned to plot options pie color. Here's the sample code in swift:
let plot_options = HIPlotOptions()
plot_options.pie = HIPie()
plot_options.pie.colors = colors as? [HIColor]

keras(cnn+nn) predicting only one class among 4 classes

I am using two different datasets having 1200 images each. First dataset has 4 classes and second dataset has 6 classes.
This is simple image classification problem. But while training, on each epoch I am getting same value for validation accuracy for both the datasets.
I have resized all the images of both datasets to 100x100 using imagemagick.
I don't know where I am making mistake.
Thanks in advance
terminal output :
Using Theano backend.
Couldn't import dot_parser, loading of dot files will not be possible.
X_train shape: (880, 3, 100, 100)
880 train samples
220 test samples
train:
0 418
3 179
2 174
1 109
dtype: int64
test:
0 98
3 55
2 43
1 24
dtype: int64
Train on 880 samples, validate on 220 samples
Epoch 1/5
880/880 [==============================] - 582s - loss: 1.3444 - acc: 0.4500 - val_loss: 1.2752 - val_acc: 0.4455
Epoch 2/5
880/880 [==============================] - 540s - loss: 1.2624 - acc: 0.4750 - val_loss: 1.2802 - val_acc: 0.4455
Epoch 3/5
880/880 [==============================] - 540s - loss: 1.2637 - acc: 0.4750 - val_loss: 1.2712 - val_acc: 0.4455
Epoch 4/5
880/880 [==============================] - 538s - loss: 1.2484 - acc: 0.4750 - val_loss: 1.2623 - val_acc: 0.4455
Epoch 5/5
880/880 [==============================] - 537s - loss: 1.2375 - acc: 0.4750 - val_loss: 1.2486 - val_acc: 0.4455
prediction on test data:
In [26]: model.predict_classes(X_test)
220/220 [==============================] - 37s
Out[26]:
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
code:
from __future__ import print_function
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers.convolutional import Convolution2D, MaxPooling2D, Convolution1D, MaxPooling1D
from keras.optimizers import SGD
from keras.utils import np_utils, generic_utils
import numpy as np
from sklearn.cross_validation import train_test_split
import pandas as pd
batch_size = 30
nb_classes = 4
nb_epoch = 10
img_rows, img_cols = 100, 100
img_channels = 3
X = np.load( 'image-data.npy' )
y = np.load( 'image-class.npy' )
# the data, shuffled and split between train and test sets
X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=100 )
print('X_train shape:', X_train.shape)
print(X_train.shape[0], 'train samples')
print(X_test.shape[0], 'test samples')
print("train:\n ",pd.value_counts(y_train))
print("test:\n",pd.value_counts(y_test))
Y_train = np_utils.to_categorical(y_train, nb_classes)
Y_test = np_utils.to_categorical(y_test, nb_classes)
model = Sequential()
model.add(Convolution2D(32, 3, 3, border_mode='same', input_shape=(img_channels, img_rows, img_cols)))
model.add(Activation('relu'))
model.add(Convolution2D(32, 3, 3))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2), strides=(1,1) ))
model.add(Dropout(0.25))
model.add(Convolution2D(64, 3, 3, border_mode='same'))
model.add(Activation('relu'))
model.add(Convolution2D(64, 3, 3))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2), strides=(1,1) ))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(256))
model.add(Activation('relu'))
model.add(Dropout(0.25))
model.add(Dense(nb_classes))
model.add(Activation('softmax'))
sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimizer=sgd)
model.fit(X_train, Y_train , batch_size = batch_size, nb_epoch = nb_epoch,shuffle=True, show_accuracy=True,validation_data=(X_test,Y_test) )
out = model.predict_classes(X_test)

Imagemagick lower PNG depth

I have a huge number of images provided from various artists working on a project. The images have varying specs, but all are PNGs. Some are 8-bit indexed (palette), others are true color with alpha 32-bit and 64-bit PNGs.
Now, I am trying to use imagemagick to push all these images to a single coherent format, but I am facing a painful issue. I noticed that images that have been converted from truecolor with alpha (16-bit channel depth) work like a charm. However, 8-bit per channel images, or possibly lower/higher images get somewhat corrupted and the rendering engine (on iOS) we have will not display the images properly.
Is there a way to simply convert all images robustly to a single 8-bit per channel truecolor with alpha PNG format (RGBA8888)?
(NOTE: I read in the wikipedia link true color & alpha is at least 32 bits per channel, I need to reduce the depth by trimming it to reduce the file size. The rendering engine will also take care of that.)
I tried the following commands:
/opt/local/bin/convert -depth 8 {} {}
/opt/local/bin/convert {} -depth 8 {}
/opt/local/bin/convert {} -colorspace sRGB -depth 8 {}
/opt/local/bin/convert {} -type truecolormatte -depth 8 {}
Here are two images from running the last command, the second one doesn't run on the engine:
Image: bu_hu_townhall_l01.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 640x558+0+0
Resolution: 28.35x28.35
Print size: 22.575x19.6825
Units: PixelsPerCentimeter
Type: TrueColorAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 8-bit
Channel statistics:
Red:
min: 0 (0)
max: 255 (1)
mean: 207.468 (0.8136)
standard deviation: 60.7017 (0.238046)
kurtosis: 1.18939
skewness: -1.39109
Green:
min: 0 (0)
max: 255 (1)
mean: 205.419 (0.805565)
standard deviation: 56.0321 (0.219734)
kurtosis: 1.15995
skewness: -1.22368
Blue:
min: 0 (0)
max: 255 (1)
mean: 174.337 (0.683673)
standard deviation: 79.2051 (0.310608)
kurtosis: -0.8628
skewness: -0.578582
Alpha:
min: 0 (0)
max: 255 (1)
mean: 96.4893 (0.37839)
standard deviation: 123.454 (0.484134)
kurtosis: -1.74557
skewness: -0.501528
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 186.434 (0.731112)
standard deviation: 84.1704 (0.33008)
kurtosis: 0.210139
skewness: -1.19818
Alpha: srgba(255,255,255,0) #FFFFFF00
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.63999,0.33001)
green primary: (0.3,0.6)
blue primary: (0.15,0.05999)
white point: (0.31269,0.32899)
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 640x558+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2013-07-19T12:48:10-07:00
date:modify: 2013-07-19T12:48:10-07:00
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45454544 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 6
png:IHDR.color_type: 6 (RGBA)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 640, 558
png:pHYs: x_res=2835, y_res=2835, units=1
png:sRGB: intent=0 (Perceptual Intent)
png:text: 2 tEXt/zTXt/iTXt chunks were found
signature: 547acae3cbfddef87d1ec49fb4dbe259772343ed121a8f9bfe2f1846fc542cf0
Artifacts:
filename: bu_hu_townhall_l01.png
verbose: true
Tainted: False
Filesize: 333KB
Number pixels: 357K
Pixels per second: 17.86MB
User time: 0.010u
Elapsed time: 0:01.019
Version: ImageMagick 6.8.6-0 2013-07-03 Q16 http://www.imagemagick.org
And...
Image: red_circle.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 256x256+0+0
Resolution: 28.35x28.35
Print size: 9.02998x9.02998
Units: PixelsPerCentimeter
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 1-bit
green: 1-bit
blue: 1-bit
alpha: 8-bit
Channel statistics:
Red:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Green:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Alpha:
min: 0 (0)
max: 40 (0.156863)
mean: 6.30113 (0.0247103)
standard deviation: 10.7071 (0.0419887)
kurtosis: 1.47694
skewness: -1.66221
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 125.925 (0.493822)
standard deviation: 5.35356 (0.0209944)
kurtosis: 309547
skewness: 77.6945
Alpha: srgba(255,0,0,0) #FF000000
Colors: 41
Histogram:
37164: (255, 0, 0, 0) #FF000000 srgba(255,0,0,0)
4416: (255, 0, 0, 1) #FF000001 srgba(255,0,0,0.00392157)
1974: (255, 0, 0, 2) #FF000002 srgba(255,0,0,0.00784314)
1394: (255, 0, 0, 4) #FF000004 srgba(255,0,0,0.0156863)
1154: (255, 0, 0, 5) #FF000005 srgba(255,0,0,0.0196078)
982: (255, 0, 0, 8) #FF000008 srgba(255,0,0,0.0313725)
942: (255, 0, 0, 7) #FF000007 srgba(255,0,0,0.027451)
893: (255, 0, 0, 10) #FF00000A srgba(255,0,0,0.0392157)
758: (255, 0, 0, 3) #FF000003 srgba(255,0,0,0.0117647)
754: (255, 0, 0, 11) #FF00000B srgba(255,0,0,0.0431373)
752: (255, 0, 0, 14) #FF00000E srgba(255,0,0,0.054902)
749: (255, 0, 0, 13) #FF00000D srgba(255,0,0,0.0509804)
698: (255, 0, 0, 16) #FF000010 srgba(255,0,0,0.0627451)
684: (255, 0, 0, 17) #FF000011 srgba(255,0,0,0.0666667)
657: (255, 0, 0, 19) #FF000013 srgba(255,0,0,0.0745098)
636: (255, 0, 0, 20) #FF000014 srgba(255,0,0,0.0784314)
635: (255, 0, 0, 38) #FF000026 srgba(255,0,0,0.14902)
630: (255, 0, 0, 32) #FF000020 srgba(255,0,0,0.12549)
604: (255, 0, 0, 23) #FF000017 srgba(255,0,0,0.0901961)
598: (255, 0, 0, 26) #FF00001A srgba(255,0,0,0.101961)
589: (255, 0, 0, 28) #FF00001C srgba(255,0,0,0.109804)
574: (255, 0, 0, 34) #FF000022 srgba(255,0,0,0.133333)
574: (255, 0, 0, 31) #FF00001F srgba(255,0,0,0.121569)
568: (255, 0, 0, 22) #FF000016 srgba(255,0,0,0.0862745)
551: (255, 0, 0, 29) #FF00001D srgba(255,0,0,0.113725)
542: (255, 0, 0, 6) #FF000006 srgba(255,0,0,0.0235294)
541: (255, 0, 0, 25) #FF000019 srgba(255,0,0,0.0980392)
516: (255, 0, 0, 37) #FF000025 srgba(255,0,0,0.145098)
485: (255, 0, 0, 35) #FF000023 srgba(255,0,0,0.137255)
387: (255, 0, 0, 9) #FF000009 srgba(255,0,0,0.0352941)
381: (255, 0, 0, 12) #FF00000C srgba(255,0,0,0.0470588)
327: (255, 0, 0, 36) #FF000024 srgba(255,0,0,0.141176)
327: (255, 0, 0, 24) #FF000018 srgba(255,0,0,0.0941176)
326: (255, 0, 0, 15) #FF00000F srgba(255,0,0,0.0588235)
316: (255, 0, 0, 21) #FF000015 srgba(255,0,0,0.0823529)
305: (255, 0, 0, 18) #FF000012 srgba(255,0,0,0.0705882)
304: (255, 0, 0, 27) #FF00001B srgba(255,0,0,0.105882)
270: (255, 0, 0, 33) #FF000021 srgba(255,0,0,0.129412)
254: (255, 0, 0, 30) #FF00001E srgba(255,0,0,0.117647)
251: (255, 0, 0, 39) #FF000027 srgba(255,0,0,0.152941)
74: (255, 0, 0, 40) #FF000028 srgba(255,0,0,0.156863)
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64733,0.33636)
green primary: (0.28904,0.6052)
blue primary: (0.1235,0.0424)
white point: (0.28021,0.296)
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 256x256+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2013-07-19T12:48:29-07:00
date:modify: 2013-07-19T12:48:29-07:00
png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:iCCP: chunk was found
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 3
png:IHDR.color_type: 3 (Indexed)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 256, 256
png:pHYs: x_res=2835, y_res=2835, units=1
png:PLTE.number_colors: 42
png:text: 2 tEXt/zTXt/iTXt chunks were found
png:tRNS: chunk was found
signature: f41a73e5fe161c06aa147572380ab95b6e43a411fa533b6533af37e2d19a161e
Profiles:
Profile-icc: 3224 bytes
Description: Display
Manufacturer: Display
Model: Display
Copyright: Copyright Apple, Inc., 2013
Artifacts:
filename: red_circle.png
verbose: true
Tainted: False
Filesize: 8.44KB
Number pixels: 65.5K
Pixels per second: 0B
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.8.6-0 2013-07-03 Q16 http://www.imagemagick.org
This is how it was before it got corrupted:
Image: red_circle.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 256x256+0+0
Resolution: 28.35x28.35
Print size: 9.02998x9.02998
Units: PixelsPerCentimeter
Type: PaletteAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 1-bit
green: 1-bit
blue: 1-bit
alpha: 8-bit
Channel statistics:
Red:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Green:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Alpha:
min: 0 (0)
max: 40 (0.156863)
mean: 6.30113 (0.0247103)
standard deviation: 10.7071 (0.0419887)
kurtosis: 1.47694
skewness: -1.66221
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 125.925 (0.493822)
standard deviation: 5.35356 (0.0209944)
kurtosis: 309547
skewness: 77.6945
Alpha: srgba(255,0,0,0) #FF000000
Colors: 41
Histogram:
37164: (255, 0, 0, 0) #FF000000 srgba(255,0,0,0)
4416: (255, 0, 0, 1) #FF000001 srgba(255,0,0,0.00392157)
1974: (255, 0, 0, 2) #FF000002 srgba(255,0,0,0.00784314)
1394: (255, 0, 0, 4) #FF000004 srgba(255,0,0,0.0156863)
1154: (255, 0, 0, 5) #FF000005 srgba(255,0,0,0.0196078)
982: (255, 0, 0, 8) #FF000008 srgba(255,0,0,0.0313725)
942: (255, 0, 0, 7) #FF000007 srgba(255,0,0,0.027451)
893: (255, 0, 0, 10) #FF00000A srgba(255,0,0,0.0392157)
758: (255, 0, 0, 3) #FF000003 srgba(255,0,0,0.0117647)
754: (255, 0, 0, 11) #FF00000B srgba(255,0,0,0.0431373)
752: (255, 0, 0, 14) #FF00000E srgba(255,0,0,0.054902)
749: (255, 0, 0, 13) #FF00000D srgba(255,0,0,0.0509804)
698: (255, 0, 0, 16) #FF000010 srgba(255,0,0,0.0627451)
684: (255, 0, 0, 17) #FF000011 srgba(255,0,0,0.0666667)
657: (255, 0, 0, 19) #FF000013 srgba(255,0,0,0.0745098)
636: (255, 0, 0, 20) #FF000014 srgba(255,0,0,0.0784314)
635: (255, 0, 0, 38) #FF000026 srgba(255,0,0,0.14902)
630: (255, 0, 0, 32) #FF000020 srgba(255,0,0,0.12549)
604: (255, 0, 0, 23) #FF000017 srgba(255,0,0,0.0901961)
598: (255, 0, 0, 26) #FF00001A srgba(255,0,0,0.101961)
589: (255, 0, 0, 28) #FF00001C srgba(255,0,0,0.109804)
574: (255, 0, 0, 34) #FF000022 srgba(255,0,0,0.133333)
574: (255, 0, 0, 31) #FF00001F srgba(255,0,0,0.121569)
568: (255, 0, 0, 22) #FF000016 srgba(255,0,0,0.0862745)
551: (255, 0, 0, 29) #FF00001D srgba(255,0,0,0.113725)
542: (255, 0, 0, 6) #FF000006 srgba(255,0,0,0.0235294)
541: (255, 0, 0, 25) #FF000019 srgba(255,0,0,0.0980392)
516: (255, 0, 0, 37) #FF000025 srgba(255,0,0,0.145098)
485: (255, 0, 0, 35) #FF000023 srgba(255,0,0,0.137255)
387: (255, 0, 0, 9) #FF000009 srgba(255,0,0,0.0352941)
381: (255, 0, 0, 12) #FF00000C srgba(255,0,0,0.0470588)
327: (255, 0, 0, 36) #FF000024 srgba(255,0,0,0.141176)
327: (255, 0, 0, 24) #FF000018 srgba(255,0,0,0.0941176)
326: (255, 0, 0, 15) #FF00000F srgba(255,0,0,0.0588235)
316: (255, 0, 0, 21) #FF000015 srgba(255,0,0,0.0823529)
305: (255, 0, 0, 18) #FF000012 srgba(255,0,0,0.0705882)
304: (255, 0, 0, 27) #FF00001B srgba(255,0,0,0.105882)
270: (255, 0, 0, 33) #FF000021 srgba(255,0,0,0.129412)
254: (255, 0, 0, 30) #FF00001E srgba(255,0,0,0.117647)
251: (255, 0, 0, 39) #FF000027 srgba(255,0,0,0.152941)
74: (255, 0, 0, 40) #FF000028 srgba(255,0,0,0.156863)
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64733,0.33636)
green primary: (0.28904,0.6052)
blue primary: (0.1235,0.0424)
white point: (0.28021,0.296)
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 256x256+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2013-07-18T20:55:49-07:00
date:modify: 2013-07-18T20:55:49-07:00
png:cHRM: chunk was found (see Chromaticity, above)
png:iCCP: chunk was found
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 6
png:IHDR.color_type: 6 (RGBA)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 256, 256
png:pHYs: x_res=2835, y_res=2835, units=1
signature: f41a73e5fe161c06aa147572380ab95b6e43a411fa533b6533af37e2d19a161e
Profiles:
Profile-icc: 3224 bytes
Description: Display
Manufacturer: Display
Model: Display
Copyright: Copyright Apple, Inc., 2013
Artifacts:
filename: red_circle.png
verbose: true
Tainted: False
Filesize: 11.2KB
Number pixels: 65.5K
Pixels per second: 0B
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.8.6-0 2013-07-03 Q16 http://www.imagemagick.org
If you are using ImageMagick, you can force the images to be written as RGBA8888 PNG with
/opt/local/bin/convert input.png png32:output.png

glColorPointer iOS Open GL ES not working?

I am drawing a simple GL_LINE_LOOP on a black background. No matter what I do with the glColorPointer and colors[] array I can't make the lines any other color than white. What am I doing wrong?
I'm relatively new to open gl for iPhone and haven't found an answer on Google or here for my problem so I really appreciate any answers.
//glPushMatrix();
glDisable(GL_TEXTURE_2D);
static const GLubyte colors[] = {
255, 0, 255, 255,
255, 0, 255, 255,
255, 0, 255, 255
};
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState (GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glLineWidth(5.0);
GLfloat vertices[] = { -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0 };
glVertexPointer(3, GL_FLOAT, 0, vertices);
glDrawArrays(GL_LINE_LOOP, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
Try disabling texturing...
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,0);

Resources