1. A method of optimizing compression of a 3D image including at least a color image and a depth image, the method comprising: generating at least one candidate quantization parameter based on whether an edge is detected in an area of the color image corresponding to an area of the depth image; calculating a rate-distortion cost with respect to each of the at least one candidate quantization parameter based on a determined degree of distortion of each of the at least one candidate quantization parameter and based on a determined number of generated bits for each of the at least one candidate quantization parameter; selecting a compression mode that minimizes the calculated rate-distortion cost with respect to each of the at least one candidate quantization parameter; and selecting an optimal quantization parameter from among the at least one candidate quantization parameter for an encoding of the depth image.